Skip to content

Benchmarking Guide

How to measure Pion on your own machine, and how not to fool yourself doing it.

Before you measure

A benchmark on a busy machine produces a wrong number, not an error. Run the pre-flight check first:

python3 benchmarks/preflight.py

It exits non-zero when something would distort the run — a leaked pion-server or redis-server from an earlier test, a compile job, high load average, low disk, Spotlight indexing — and says which of those you can remove and which you have to wait out. It never kills anything. Every benchmark script run with --gate calls it.

The rules it encodes:

  • Leaked servers slow the write-heavy rows far more than the reads. A write-row miss with healthy read rows means a resident process, not a slow disk. Stop leftover servers by exact name (pkill -x pion-server, then pgrep -x pion-server to confirm).
  • Warm up. The first few runs on an idle machine are consistently low.
  • Compare against the previous commit on the same machine, interleaved (A B B A), rather than against an absolute number from somewhere else.

KV throughput — memtier_benchmark

benchmarks/memtier-benchmark/memtier-benchmark.py wraps memtier_benchmark and measures mixed SET/GET at several pipeline depths.

# Pion only (throughput + pipeline profiles)
python3 benchmarks/memtier-benchmark/memtier-benchmark.py --pion-only --profiles throughput,pipeline -w 1

# Redis + Valkey + Dragonfly + Pion
python3 benchmarks/memtier-benchmark/memtier-benchmark.py --all-profiles -w 1

KV per-command — valkey-benchmark

benchmarks/valkey-benchmark/valkey-benchmark.py wraps redis-benchmark and reports 20 commands individually.

python3 benchmarks/valkey-benchmark/valkey-benchmark.py -c 50 -n 100000 -P 10 -w 1 --pion-only
python3 benchmarks/valkey-benchmark/valkey-benchmark.py -c 50 -n 100000 -P 10 -w 1 --pion-only --gate

With --gate, each row is checked against its floor in benchmarks/gate_baselines.json and the script exits 1 on a miss. Floors are per machine class (--gate-profile mac or linux-epyc-8124p); a Linux server CPU and an Apple M-series chip are not interchangeable.

Parameter Value Notes
-c 50 50 concurrent clients
-n 100000 100K requests per command
-P 10 Pipeline depth 10 Pion's advantage is at pipeline depth
-w 1 1 worker One keyspace; the per-command floors are single-worker

Some rows sit close to their floor, so ordinary run-to-run noise of a few percent can flip them. MSET in particular depends on its position in the run (it is measured warm, eighth of the command groups); do not reorder the groups or read a standalone -t mset against the floor.

On Linux the script pins the server and the client to separate physical cores of one L3 domain, and prints the placement it chose (--pin off leaves placement to the scheduler). Unpinned, the single-worker rows on an AMD EPYC 8124P came out in one of two modes, about 25% apart, depending only on where the scheduler put the client. With the client in the server's L3 domain, every run measured the higher mode, which is the one the Linux floors were taken from. In another domain, or on the server's SMT sibling, every run measured the lower mode. On macOS the flag has no effect.

Linux backend selection

  • --epoll runs at parity with Redis at P=1 (91-96K RPS on Linux localhost, where every engine hits the same TCP ceiling). Best for per-command -w 1 runs.
  • io_uring (default) is behind at P=1 on some CPUs but wins at high concurrency (P>=10). Which one wins at P=1 depends on the CPU generation, so measure both on a new machine.

P=1: a single-threaded server is bound by a syscall per request. On the published Linux run, pion-server -w 1 measured 112,019 ops/sec and single-threaded Redis 107,896, while Redis with io-threads 8 reached 388,405 (raw output). I/O threads take the syscalls off the thread that runs commands. On 2026-10-12, Pion with --io-threads 8 measured 515,267 against Redis's io-threads 8 at 386,278 (raw output).


Vector search — VectorDBBench

benchmarks/VectorDBBench/vectordb-benchmark.py, on the Performance1536D50K dataset (1536 dims, 50K vectors).

pixi run install-vdbbench   # venv_zvec with Python 3.11 or 3.12; 3.14 breaks vectordbbench
python3 benchmarks/VectorDBBench/vectordb-benchmark.py --pion-only --ef-runtime 150 --workers 10
python3 benchmarks/VectorDBBench/vectordb-benchmark.py --pion-only --ef-runtime 150 --workers 10 --gate

install-vdbbench also patches VectorDBBench, whose stock Redis client never sends FT.OPTIMIZE. Unpatched, every query searches an index that was never built: recall 0.0 at an impossible QPS. The harness refuses such a run and names the task.

Parameter Value
Dataset Performance1536D50K
HNSW M 16
ef_construction 128
ef_runtime 150
Workers 10 (-w 10 --independent-workers)
Quantization INT8

Vector QPS on a laptop is noisy: identical binaries measure noticeably different QPS from run to run, and the first run of a series is usually the low one. Recall varies by a few tenths of a point between runs because the graph build is randomized, and an occasional single run dips further; check whether a low number reproduces before reading anything into it.

Each run keeps the Pion server's output in benchmarks/VectorDBBench/server_logs/pion-<timestamp>.log (gitignored), and the results file names that log under the run's table. A dip is usually a bad build, not a slow search, and the build's own lines ([HNSW] level-0 ..., link drops, the quant mode that actually ran) are the only record of it. The harness prints those lines after the run. PION_BENCH_SERVER_LOG=<path> picks the file, and PION_BENCH_SERVER_LOG=off discards the output as before.


Protocol parity

python3 tests/test_parity.py

Checks Redis protocol compatibility across ~45 command families.


Notes

  • Startup wait: a server is listening before it can serve; the harnesses wait for a real +PONG.
  • Linux io_uring requires --security-opt seccomp=unconfined in Docker.
  • Linux build: gcc -c src/ffi/uring_wrap.c -o src/ffi/uring_wrap.o before pixi run build.