Benchmarks
Compare pg_redis storage modes against Valkey with redis-benchmark.
make bench runs mise’s redis-benchmark with identical flags against pg_redis
() and Valkey ().
Default pairing
The default comparison is the closest durable pair:
- pg_redis — logged tables with synchronous commit
- Valkey — AOF with
appendfsync always
That is the closest available crash-durability comparison; the implementations still have different transaction and batching semantics.
make bench # current PG_STORAGE_MODE (default unlogged) vs Valkey
make bench-matrix # memory,unlogged,logged-async,logged × Valkey modes
make bench-publish # refresh README + bench/latest.{csv,md}
PG_STORAGE_MODE=memory make bench-pg
Matrix modes
make bench-matrix runs three repetitions per configuration and reports median,
minimum, and maximum throughput:
| Target mode | Persistence behavior |
|---|---|
pg_redis/memory |
In-gateway map (max throughput); optional snapshots off during benches |
pg_redis/unlogged |
No table WAL; survives clean restart, truncates after crash |
pg_redis/logged-async |
WAL-logged, but commit returns before WAL is flushed |
pg_redis/logged |
Normal WAL-logged tables; commit waits for durable WAL |
valkey/none |
No RDB or AOF; process data is volatile |
valkey/rdb |
Valkey’s default periodic snapshots; AOF off |
valkey/aof-everysec |
AOF with an approximately one-second loss window |
valkey/aof-always |
AOF fsync for each command/batch before reply |
Default tests are ping,set,get (-t ping exercises both inline PING\r\n
and RESP PING_MBULK).
Tuning
| Variable | Role |
|---|---|
BENCH_REQUESTS |
Requests per test |
BENCH_CLIENTS |
Concurrent clients |
BENCH_PIPELINE |
Pipeline depth |
BENCH_MATRIX_REPETITIONS |
Repetitions for matrix medians |
PG_STORAGE_MODE |
pg_redis mode for single benches |
BASELINE_MODE |
Valkey mode for single benches |
PG_STORAGE_MODE=memory BASELINE_MODE=none make bench
PG_STORAGE_MODE=unlogged BASELINE_MODE=none make bench
BENCH_REQUESTS=50000 BENCH_MATRIX_REPETITIONS=5 make bench-matrix
BENCH_REQUESTS=50000 BENCH_CLIENTS=20 BENCH_PIPELINE=16 make bench
./scripts/run_bench.sh --pg-only # only :6379
./scripts/run_bench.sh --baseline-only # only :6380
Published results
make bench-publish runs the matrix and refreshes:
- the generated benchmark block in
README.md - tracked
bench/latest.md - tracked
bench/latest.csv
Keep those three generated files in the same commit.
Single comparisons write CSV + a table under bench/results/<timestamp>/.
Matrices write all repetitions, matrix.csv, and comparison.txt under
bench/results/matrix-<timestamp>-<pid>/.
See the latest committed summary in
bench/latest.md.