Design decisions

Write path and durability

Decisions about the write-ahead log, group commit, thread-per-core execution and when a write is acknowledged (D10, D11, D12, D21, D37).

D10 WAL: leader/follower group commit, 8-byte records, zero length ends the log#

Whoever wins a compare-and-swap flushes everything appended; the others wait and re-check. A CRC-32C covers length and payload, and the file is zero-filled ahead so a torn tail is simply an invalid or zero header. A failed write or sync poisons the log. Rejected: parallel insertion buffers, an artificial commit delay, and large PostgreSQL-style headers. Property tests cover every torn length and every bit flip.

D11 Durable-write benchmarks model the thread-per-core server#

The durable-write target is measured with 8 worker threads of 32 connections each. A run with 256 OS threads is reported as a reference only, because it measures operating-system thread wake-ups and not the log. The modelling choice is stated next to every result.

D12 Thread-per-core with one SPSC ring per core pair#

Every ordered pair of cores has its own ring of small inline messages, there are no locks on the read path, and the owning core is chosen from hash bits 16 to 32. Rejected: a shared hash table with locks, one ring of heap work items (an allocation per request), and choosing the shard from the top hash bits (deeper directories than needed). Per-core allocator, I/O mechanism and thread pinning were left open.

D21 Write path = check, log, apply; acknowledge after the durable position passes#

The log is written before memory changes, and a rejected write never reaches the log. The shard thread never blocks on fsync: a flusher thread commits the latest position and clients are acknowledged from the durable position. Blocking commits capped one thread at 134k writes per second because only one fsync was in flight; the pipelined path removed that cap.

D37 Windows: open the log write-through#

PostgreSQL's default on Windows opens its WAL with FILE_FLAG_WRITE_THROUGH instead of flushing after each write. A probe showed a write-through write about seven times cheaper than write plus FlushFileBuffers. The WAL now opens write-through on Windows (the portable feature turns it off) and keeps the file zero-filled to its length, because writing past valid data costs a metadata update on NTFS. Acknowledged means on stable storage under the operating system's write-through contract, the same contract PostgreSQL relies on. Linux O_DSYNC is future work.