Benchmark harnesses
The repository has two benchmark harnesses that answer different questions:
| Harness | Where | Measures | Network | Compared with |
|---|---|---|---|---|
| Criterion micro-benchmarks | benches/*.rs |
One engine operation in process: memtable, WAL, LSM engine, HNSW, distance functions, SQL parsing | None | Nothing; absolute times on your machine |
| Proof-pack throughput | prove/bench.py |
Requests per second over each wire, through real client drivers or the database's own benchmark tool | Loopback and Docker bridge | The real database running next to SynergyDB |
The published performance numbers in Benchmarks and reproduction come from the second kind (pgbench, sysbench, redis-benchmark, memtier and same-client runs), not from Criterion. This page explains how both harnesses work and how to read them. For load and crash testing see Load and soak testing.
Criterion benches
Setup
Cargo declares four bench targets, each with harness = false, so Criterion's criterion_main! supplies main: storage_bench, vector_bench, query_bench and concurrent_workloads. The dev-dependency is criterion = "0.5" with the async_tokio feature, though no bench uses an async runner. The bench profile sets lto = true and codegen-units = 1 (source: Cargo.toml, [[bench]], [dev-dependencies], [profile.bench]; benches/*.rs).
Running
| Goal | Command | Source |
|---|---|---|
| Every bench | cargo bench |
CONTRIBUTING.md, "Running Benchmarks" |
| One bench target |
cargo bench --bench storage_bench (or vector_bench, query_bench, concurrent_workloads) |
module docs of each file |
| One group or benchmark |
cargo bench --bench concurrent_workloads -- engine_scan (a name filter passed to Criterion) |
Criterion's own command line |
Criterion writes its estimates and HTML reports under target/criterion/ and compares each run with the previous one stored there. That is Criterion's default behaviour; the repository does not configure it. Not verified: no Criterion results or baselines are committed in the snapshot, so there are no reference numbers to compare a run against.
The default build uses mimalloc as the global allocator through heap::Counting, so benches measure with that allocator unless built with --features system-allocator (source: src/lib.rs, GLOBAL). See Building.
storage_bench.rs
| Group / benchmark | What one iteration does | Setup |
|---|---|---|
memtable/insert |
MemTable::insert of one InternalKey::put and value (key_%08d, value_%08d) |
64 MB memtable |
memtable/get |
MemTable::get of one of 10,000 keys |
10,000 keys inserted first |
memtable/scan_100 |
MemTable::scan over a 100-key window |
10,000 keys inserted first |
wal/append_sync |
WalManager::append with WalSyncMode::EveryWrite (an fsync per append) |
Temp dir, 64 MB segment; sample size 20 |
wal/append_no_sync |
Same with WalSyncMode::NoSync
|
Same |
(source: benches/storage_bench.rs, memtable_benchmark, wal_benchmark)
append_sync is the fsync cost of one WAL write on the machine's disk. The comment notes it is millisecond-scale on Windows (source: benches/storage_bench.rs, comment above sample_size).
concurrent_workloads.rs
These drive the real StorageEngine (memtable, WAL, SSTables) directly, with no wire protocol, values of 256 bytes, keys k%010d, and a global atomic counter as the MVCC timestamp. The WAL runs in NoSync mode so the numbers show the engine write path rather than fsync cost (source: benches/concurrent_workloads.rs, module doc, open_engine, next_ts).
| Group | Parameter | Workload per iteration | Sample size |
|---|---|---|---|
engine_sequential_writes |
100, 1,000, 10,000 | That many puts of new keys into one long-lived engine |
20 |
engine_sequential_reads |
100, 1,000, 10,000 | That many gets from an engine preloaded with that many keys |
20 |
engine_concurrent_read_heavy |
2, 4, 8, 16 threads | 1,000 ops per thread over 10,000 keys: 90% get, 10% put
|
10 |
engine_concurrent_write_heavy |
2, 4, 8, 16 threads | 500 ops per thread: 30% reads, 70% inserts of new keys | 10 |
engine_concurrent_mixed_crud |
2, 4, 8, 16 threads | 500 ops per thread over 2,000 keys: 40% reads, 20% inserts, 20% updates, 10% deletes, 10% short range scans | 10 |
engine_point_query_latency |
id_0, id_50000, id_99999
|
One get in a 100,000-key engine |
20 |
engine_scan |
width 10, 100, 1,000, 10,000 | One scan from the first key over that width, in a 100,000-key engine |
10 |
engine_high_contention |
4, 8, 16, 32 threads | 500 ops per thread on 10 hot keys: 50% get, 50% put
|
10 |
wal_entry_encode |
64, 256, 1,024, 4,096 bytes |
WalEntry::encode of one entry |
default |
(source: benches/concurrent_workloads.rs, the bench_* functions and criterion_group!)
Reading notes:
- Throughput is declared as
Throughput::Elements(ops)(orBytesforwal_entry_encode), so Criterion reports elements per second as well as time per iteration (source:benches/concurrent_workloads.rs,group.throughputcalls). - In the concurrent groups each iteration spawns its threads with
std::thread::spawnand joins them, so thread creation is inside the measured time. At small per-thread op counts that overhead is a visible share of the result (source:benches/concurrent_workloads.rs,bench_concurrent_read_heavyand siblings). - Each thread picks keys and operations with a fixed linear congruential sequence seeded by its thread index, so runs are repeatable (source: same functions,
rng_seed). -
engine_sequential_writeskeeps inserting new keys into one engine across all iterations, so later samples include memtable growth and background flushes (source:benches/concurrent_workloads.rs, comment inbench_sequential_writes).
vector_bench.rs
| Group / benchmark | What it does | Setup |
|---|---|---|
hnsw/search_k10_ef100_n10000_d128 |
HnswIndex::search for k = 10 |
10,000 deterministic 128-dimension vectors, L2, m = 16, m_max0 = 32, ef_construction = 200, then set_ef(100); sample size 20 |
hnsw/search_k50_ef100_n10000_d128 |
Same for k = 50 | Same index |
hnsw/insert_d128 |
One insert into a fresh, growing index with the same parameters | Empty index at start |
distance/l2/<dim>, distance/cosine/<dim>, distance/inner_product/<dim>
|
Vector::distance with that metric |
Dimensions 32, 128, 512, 1,536 |
(source: benches/vector_bench.rs, hnsw_benchmark, distance_benchmark)
The vectors are generated from index arithmetic, not random data, so recall and graph shape differ from real embeddings. The bench measures speed only and checks no recall (source: benches/vector_bench.rs).
query_bench.rs
| Benchmark | What it does |
|---|---|
parse_simple_select |
SqlAnalyzer::parse of a one-table SELECT with a WHERE
|
parse_complex_select |
SqlAnalyzer::parse of a join with GROUP BY, HAVING, ORDER BY and LIMIT
|
l2_distance_128d, cosine_distance_128d, inner_product_128d
|
Vector::distance on 128 dimensions |
(source: benches/query_bench.rs)
This file measures parsing only. No Criterion bench runs a query through QueryEngine or a wire; that is covered by prove/bench.py and by the timing tests in tests/perf_baseline.rs (see Load and soak testing).
prove/bench.py: throughput against the real database
How it is run
prove/prove.py calls bench.py <wire> --secs S --threads T --clients C --pg-scale N after a wire's correctness steps, on a freshly wiped SynergyDB so suite leftovers do not skew it, with a 30-minute timeout. It collects every output line that starts with RESULT as JSON (wire, workload, sdb, ref, unit, tool, note) and stores them in results.json under wires[].bench (source: prove/prove.py, run_wire, run_bench; prove/bench.py, emit).
| Command | Effect | Source |
|---|---|---|
make bench |
prove/prove.sh --bench-only: every wire, throughput only |
Makefile |
make bench ARGS='--bench-clients 1,8,32 --pg-scale 50 --bench-secs 30' |
The form suggested for a large machine |
Makefile, comment on bench
|
prove/prove.sh --bench-only --update prove/out/latest |
Replace only the throughput rows of an existing report |
prove/prove.py, main
|
python prove/bench.py postgres |
One wire against servers that are already running |
prove/README.md, "How it is put together" |
bench.py options and defaults: --secs 10, --threads 8, --pg-scale 10, --clients 1,8, --kafka-records 300000, --sb-rows 100000, --no-sysbench. prove.py passes only the first four, so the Kafka record count, sysbench table size and sysbench switch take their defaults in a make bench run (source: prove/bench.py, main; prove/prove.py, run_bench).
Reaching the reference without docker-proxy
SynergyDB runs as a native process and the references run in Docker. Docker publishes container ports through docker-proxy, a userland relay. The code comment records pgbench select-only at about 28k tps through it against 76k direct on a 4-vCPU machine. So D(port) looks up the container that publishes that host port in refs.REFS, asks docker inspect for its address, and connects to the container port directly. PROVE_BENCH_VIA_PROXY=1 uses the published port instead (source: prove/bench.py, D, DU, comment above _DIRECT). The status entry that introduced this says the first report overstated SynergyDB by 2 to 5 times on most wires because of the proxy (source: docs/status/2026-11-24-proof-pack-fair-bench.md).
Native tools
| Wire | Tool and image | Workloads | Settings |
|---|---|---|---|
| PostgreSQL |
pgbench from postgres:16
|
TPC-B at each --clients value; select-only (-S) at each value above 1 |
-i -q -s <pg-scale> on both, then -c C -j min(C,4) -T 2*secs -n; result is tps
|
| MySQL |
sysbench from severalnines/sysbench
|
oltp_point_select, oltp_read_only, oltp_read_write at each --clients value |
4 tables of --sb-rows rows, --time=2*secs; reference logs in as a mysql_native_password user because sysbench's client cannot do caching_sha2_password; on failure retried with --db-ps-mode=disable and noted |
| Redis |
redis-benchmark from redis:7
|
set, get, incr, lpush, rpop, hset
|
-c 50 -r 100000 -n 100000; compared with Redis appendfsync always, the no-fsync ratio in the note |
| Memcached |
memtier_benchmark from redislabs/memtier_benchmark:latest
|
set:get 1:4, 100 connections |
memcache_text, 4 threads x 25 connections, 1.5*secs
|
| Kafka |
kafka-producer-perf-test.sh, kafka-consumer-perf-test.sh inside the ref-kafka container |
produce acks=1, produce acks=all, consume
|
--kafka-records records of 100 bytes, one partition, new topic per run; SynergyDB reached at the Docker bridge gateway on port 9092 |
(source: prove/bench.py, bench_postgres, sysbench_mysql, bench_redis, bench_memcached, bench_kafka)
Same-client workloads
For the other wires the same Python client code runs against both servers. loop starts --threads threads, each opening its own client and repeating the operation until --secs have passed. Throughput is total operations divided by seconds. A side with 10 or more errors reports no number. If a side's data setup fails, every later workload for that side in the same wire is skipped and the note says why (source: prove/bench.py, loop, pair).
| Wire | Workloads | Data set up first |
|---|---|---|
MySQL (with sysbench too, unless --no-sysbench) |
point select by PK, update by PK, insert | 10,000 rows |
| MongoDB | find by _id, update $inc by _id, insert |
10,000 documents |
| Cassandra | select by partition key, insert (prepared statements, protocol v4) | 2,000 rows |
| ClickHouse (HTTP) |
GROUP BY aggregate, point select, insert 100 rows |
10,000 rows in a MergeTree table |
| InfluxDB | write 100 points, mean() GROUP BY tag |
database bench
|
| Neo4j (Bolt) | node lookup by property, 2-hop traversal, create node | 1,000 nodes in a ring |
| Gremlin | vertex lookup by property, add vertex | 500 vertices |
| DynamoDB |
get_item, put_item
|
1,000 items |
| Elasticsearch | get doc by id, match query, index doc | 2,000 documents, refreshed |
| S3 |
GetObject 4 KB, PutObject 4 KB |
200 objects |
| CouchDB | GET doc, PUT new doc | 2,000 documents via _bulk_docs
|
| SQL Server | point select by PK, update by PK | 5,000 rows |
| Oracle | point select by PK, update by PK | 5,000 rows |
(source: prove/bench.py, bench_mysql, bench_mongo, bench_cassandra, bench_clickhouse, bench_influxdb, bench_cypher, bench_gremlin, bench_dynamodb, bench_es, bench_s3, bench_couchdb, bench_mssql, bench_oracle)
Schema Registry has no throughput workload. bench.py has no schema_registry entry and rejects that wire name, while prove.py still calls it unless --skip-bench is given. That wire's bench log then holds only the argument error and no rows. The Wire.bench flag in wires.py exists but prove.py does not read it (source: prove/bench.py, BENCH, main; prove/prove.py, run_wire; prove/wires.py, Wire.bench).
Durability settings
The bench.py docstring says SynergyDB runs with wal_sync_mode = "every_write", an fsync per commit, and the Redis comparison uses appendfsync always for the same reason (source: prove/bench.py, module doc, bench_redis). The config file that sets the WAL mode, test-scripts/synergydb.wirediff.toml, is not in the snapshot. Not verified: the WAL mode of the proof-pack server. Memcached keeps nothing on disk while SynergyDB persists every write, and Kafka does not fsync by default, so those ratios compare different durability (source: prove/README.md, "Throughput").
Reading the results
Each row in the report's throughput table is one RESULT line: SynergyDB's number, the reference's, the ratio, the tool and a note with the settings used. The per-wire summary shows the median ratio and its range, and the HTML header counts workloads at 90 percent of the reference or better (source: prove/report.py, render_md, render_html, speed_text).
- Absolute numbers depend on the machine, and on a laptop both servers compete for the same cores. The ratio is the figure to compare (source:
prove/README.md, "Throughput"). -
failedin a cell means that side produced no number (setup failed, or 10 or more errors) (source:prove/report.py,fmt;prove/bench.py,pair). - The raw output is in
logs/<wire>-bench.txt, including the tool's own output when a regex did not match (source:prove/prove.py,run_bench;prove/bench.py,bench_postgresand siblings). - The committed 2026-11-30 proof run was
make prove-quick, so it has no throughput rows. The throughput figures quoted in the guide come from runs on 2026-11-23 and 2026-11-24 whose raw data directory is not in the snapshot (source:docs/proof/2026-11-30/README.md; Benchmarks and reproduction).