~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

bench: the firehose part measures its lag, not the write path

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:bench-firehose-lag

The bench's firehose part timed 100 sequential putRecords, so its rate and latency were the write path's fsync cost, not the firehose's. It now measures the firehose's own lag, from a write's answer to a subscriber having its commit, and RESULTS.md is a fresh run with it.

Claude Opus 5.5 · high

What changes

harness/bench.mjs. The firehose part still makes 100 putRecords one after another with 20 subscribers, but each time is now from the write's answer to a subscriber having its commit, 0 when the commit came first. It gives no rate: the summary row is "firehose lag p50 ms", and its detail table has no per-second columns.

bench/README.md, bench/RESULTS.md, bench/results.json. The firehose part described as above; RESULTS.md's tables and the caveats that quote figures are from a new run of all four servers at f15eaf4.

Why

Throughput was 2000 deliveries over the time from the first write to the last delivery, with each write awaited before the next: about 100 × one write's round trip. spec-pds paid an F_FULLFSYNC per write with nothing to group-commit, the reference SQLite's plain fsync, which on macOS does not flush the drive's cache, so the reference "won" the firehose by ~1 ms a write while delivering commits ~20× later (p50 5.8 ms against 131.7 ms). Write throughput is createRecord's and applyWrites', at 16 and 8 at once. A rate with concurrent writers would be the write path's again; replaying from a cursor with 20 subscribers would exceed zds's and vlpds's caps on cursor backfills; so the part measures the one thing only the firehose decides, its lag.

How it was checked

node bench.mjs --setup && node bench.mjs --rounds 3 --json ../bench/results.json, all four servers, every part served; node bench.mjs --report ../bench/results.json renders the same tables. Firehose lag p50 (best round): reference 78.5 ms, spec-pds 0.4, vlpds 2.3, zds 15.0. The benchmark is no gate.

Shortcomings

  • The machine was loaded (load average 89 over the minute before the run, ~14 at its end): every absolute figure is lower and noisier than on an idle machine, as RESULTS.md says.
  • The lag is of one write at a time: fan-out under many concurrent writes, and replay from a cursor, are not measured.
  • The lag is from the answer, so a server that delivers before it answers scores 0 whatever its write costs; that cost is createRecord's to show.
Approved

This changes the bench's firehose part to time each of the 100 sequential putRecords from the write's answer to a subscriber having its commit, clamped to 0. It drops the rate. harness/bench.mjs makes rate optional in the results, and the summary and detail tables render a lag-only variant. The "not served" row keeps the right column count. bench/README.md and bench/RESULTS.md describe the new measure, and RESULTS.md is a fresh run that is coherent with the code. I read all four files, but only skimmed bench/results.json, which is generated data. It matches the numbers quoted in RESULTS.md.

The change only affects the bench, so nothing needs to change in spec/. No server code is touched and no check is loosened. The firehose part still fails if a subscriber misses a commit. The pull body and RESULTS.md state the shortcomings: lag is measured from the answer, so a server that delivers before it answers scores 0, and a loaded machine skews the figures.

Merged as 504f1c3