Tuning
The settings and choices that change Raft DB's speed, with what the benchmark results say about each.
This page lists only levers that the benchmark documents and the server document name. It is not a tuning guide verified across hardware; the effect of each lever is as measured on the machines given on the pages that report them.
Build#
- Use the released programs. A debug build would give meaningless numbers; every number on this site is from a release build.
- The
portablefeature builds the engine crates with portable code paths. On the dev PC it read slower than the native build (single reads 11.1-12.0M/s against 15.1-15.2M/s) with the same 8.75 B overhead (Engine results).
Server settings#
| Setting | Default | Effect | Source |
|---|---|---|---|
--shards N | see the server document | number of shards; the comparison runs used 2 shards, the server suite 4 | comparison log, benchmark results log |
spin-us | 150 (0 = never) | a connection's reader thread looks for the next request for up to this many microseconds before it blocks; only for a connection asking request after request, never for one with writes on the way to a shard, never when more connections are busy than a quarter of the processors | D68 |
--sync-replicas N | 0 (asynchronous) | with N of 1 or more, a write is acknowledged after N replicas confirm it is durable; this adds a network wait to every write | server record |
--sync-timeout-ms | 1000 | how long to wait for those replicas | server record |
raftdb_connections, raftdb_share (MySQL front-end) | 1, reads | how many connections the front-end holds to the row store and which requests share them | D69 |
Setting names follow one rule: command line, environment (RAFTDB_SYNC_REPLICAS), configuration file (sync-replicas = 1), in that order of
priority. See Administration.
Durability against speed#
Every comparison in this chapter acknowledges a write only after fsync, in every database. The wal suite shows the cost: raw fsync p50 431 us,
305,903 durable records per second with group commit, and 6.3M per second without fsync (2026-11-08, Windows dev PC). Turning durability off
is not what the comparisons measure.
Operating system#
- On Windows the log is opened write-through and kept zero-filled (D37): Raft DB binary protocol insert rate went from 6,557 (HTTP, before) to 26,199
operations per second in the YCSB load on the laptop (Comparison on Windows). Do not expect the same
gain on Linux, where
fdatasyncon a preallocated file is already cheap. - The server's single-connection speed depends on thread wake-ups; on a machine busy with other work the look before a receive finds fewer free processors (D68). Measure on a quiet machine.
Interface choice#
In the Windows comparison, the binary protocol was about 3x faster than the HTTP/JSON path on reads (45,290 against 14,453 operations per second, workload C). The HTTP API serves the Studio and tools; applications that want speed use the binary protocol or a connector. See Native API.
Not supported yet#
An automatic tuner, a tuned comparison of MySQL and PostgreSQL (their defaults were used) and thread sweeps are not done.