Performance Overview
These benchmarks compare aerospike-py (Rust, PyO3, and native async) with the official aerospike Python client (a C extension wrapped with loop.run_in_executor).
324 ms → 97 ms (−70%) by stacking 3 actions: switch client → batch_read consolidation → Python 3.14t.
How fast — cumulative gain on p95
Original (official client, 3.11 GIL, gather) ████████████████████████ 324 ms baseline
+ Replace with aerospike-py ██████████████ 189 ms −42%
+ gather(N) → single batch_read(mixed keys) █████████ 126 ms −61%
+ Python 3.14t free-threaded ███████ 97 ms −70% 🔥
↑ 3.3× faster
Setup: FastAPI + DLRM + Aerospike CE, k6 10 VUs × 60s, 2 replicas (4 CPU / 4 GiB request).
Recommended actions (in order)
| # | Action | Effect on p95 |
|---|---|---|
| 1 | Replace official client → aerospike-py | −42% (Python 3.11) |
| 2 | gather(N) → single batch_read(mixed keys) | −33% more (under GIL) |
| 3 | Move runtime to Python 3.14t free-threaded | −49% more, TPS +47% |
| 4 | Keep AEROSPIKE_PY_INTERNAL_METRICS=1 on | E2E overhead ≈ 0 |
Pick your environment (Python 3.11 + GIL)
A thinner application stack makes the client-level difference easier to see. The tail-latency advantage remains visible in production-shaped workloads.
- C — uvicorn + DLRM (real serving)
- B — uvicorn ASGI only
- A — Pure DB client (no HTTP/ML)
This environment covers the full path from HTTP through batch_read and DLRM CPU inference to the response. It most closely resembles a recommendation-serving pod.
| Metric | aerospike-py | official | aerospike-py advantage |
|---|---|---|---|
| avg | 118 ms | 146 ms | −19% |
| p90 | 173 ms | 293 ms | −41% |
| p95 | 189 ms | 324 ms | −42% 🔥 |
FastAPI + uvicorn around batch_read, no model inference. The "REST API in front of a key-value lookup" shape.
| Metric | aerospike-py | official | advantage |
|---|---|---|---|
| total mean | 228 ms | 290 ms | −21% |
| TPS | 19.4 | 16.6 | +17% |
A Python loop calls batch_read directly. With no HTTP or ML layers, this environment shows the largest client-level difference.
| Metric | aerospike-py | official | advantage |
|---|---|---|---|
| avg mean | 22 ms | 108 ms | −80% 🔥 |
| avg p99 | 121 ms | 195 ms | −38% |
| TPS | 374 | 138 | +171% 🔥 |
How the three docs split up
| Page | When to read it |
|---|---|
| Isolated Benchmark | "How much of the gap belongs to the client library itself?" — 5 scenarios (s1..s5) on a local podman/oha harness, response serialisation stripped out. Each scenario isolates one materialisation path (dict / to_numpy zero-copy / gather vs single / lazy subset). Includes a 3.14t section. |
| Production Benchmark | "What do real serving pods see?" — FastAPI + DLRM + Aerospike CE on k8s, k6 load, response body serialised, and two replicas. Shows how the measured p95 falls from 324 to 189 to 97 ms as the changes accumulate. Includes a 3.14t section. |
| Bottleneck Analysis | Internal stage profiling and recipes (gather→single, etc.). Currently being re-measured on the new isolated harness. |
To reproduce locally, see benchmark/README.md.