Skip to main content

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).

TL;DR — cumulative effect on DLRM-serving p95

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).

#ActionEffect on p95
1Replace official client → aerospike-py−42% (Python 3.11)
2gather(N) → single batch_read(mixed keys)−33% more (under GIL)
3Move runtime to Python 3.14t free-threaded−49% more, TPS +47%
4Keep AEROSPIKE_PY_INTERNAL_METRICS=1 onE2E 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.

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.

Metricaerospike-pyofficialaerospike-py advantage
avg118 ms146 ms−19%
p90173 ms293 ms−41%
p95189 ms324 ms−42% 🔥

→ Full numbers (Production Benchmark, env C)

How the three docs split up

PageWhen 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 AnalysisInternal stage profiling and recipes (gather→single, etc.). Currently being re-measured on the new isolated harness.

To reproduce locally, see benchmark/README.md.