chadtmiller.com/monolith
An atproto PDS
0
0
bench: the store's logs beside SQLite, and the service log by accounts
Merged Approved
This adds bench/store/, a separate cargo workspace, so SQLite never becomes a server dependency. It has a write benchmark, a log-replay benchmark and a service-log scale script, plus a store-bench workflow, a Justfile recipe and a README paragraph. I read all 11 files.
- Server and spec:
crates/andspec/are untouched, so no behaviour changes and nothing needs to be added to the spec. The README addition says what exists and how to run it, with no history in it. No atproto or MCP crates are added, and no harness check orconformance.yamlentry changes. - Numbers: the numbers I could compare agree between the body, the README and
RESULTS.md. These are the 16-writer rates, the "a fifth slower from 4 writers" figure (205 against 253 on the runner), and the Mac's load caveat. The workflow run atcb07f18succeeded. The check on the current headc0eb998was still running when I looked, and thegatesworkflow skipped itself on both commits. - Code: the benchmark code reads correctly. Locks are taken in the same order everywhere, so I see no deadlock. The log and SQLite layouts get the same commits and the same sync.
service.mjsmarks each figure that is over its bound.
The pull is correct as it stands. Its stated limitation applies: service.mjs and the write part hard-code the service-log and commit-frame formats. If those formats change, only the store-bench workflow would show it, and that workflow runs only on a change under bench/store/.
Merged as a9c10ca
A benchmark of the store by itself, kept in the repository so it can be run again: the server's logs beside SQLite under the same commits, and how the server's start and memory follow the number of accounts. Nothing of the server changes. It answers the question it was made for: SQLite would not be faster, on the Mac or on the runner, and what does not scale is the service log's start and compaction, which pulls of their own fix.
Claude Fable 5.2
What changes
bench/store/, a cargo workspace of its own, so that SQLite is a dependency of the benchmark and never of the server, and no gate builds it:
src/main.rs,store-bench write: 1500 commits, each what a createRecord leaves (the commit's block, the record's, two MST nodes, its event's frame), from 16 writers and from 4 over 40 accounts, each synced to the disk before it is answered, to four layouts: a log for each account, as the server keeps them (pds_store::Wal, the frames the server writes); one log for all; a SQLite database for each account (WAL mode,synchronous=FULL); one SQLite for all. On macOS every layout's sync isF_FULLFSYNC, and two more rows show SQLite's default there.store-bench scan: a log of those frames, 64 and 512 MiB, replayed as a start or a cold account's load reads it.service.mjs: for 10000, 30000 and 100000 accounts, without and with an email and password each, the server's start on its service log and on the checkpoint, its resident memory idle and while the service log is compacted, each beside the bound spec/STORE.md gives it; a figure over its bound in bold. The accounts' entries are written into the service log as the server writes them, so it knows that format.run.shruns all three and prints Markdown;README.mdsays what each part measures and how to read it;RESULTS.mdholds the results, one section a machine: the runner's and the Mac's.Justfile.
just store-bench [accounts...]: the server built, thenrun.sh..knotless/workflows/store-bench.yml. The same script on the runner: on a pull that changes
bench/store/or the workflow, and on main when the owner asks. It fails only if the benchmark cannot build or run.README.md. A paragraph beside the PDS benchmark's.
Why
Whether the log format is the right way to keep the server's data, against SQLite or anything else, was a question with no measurement behind it: the PDS benchmark compares whole servers, each with its own durability, language and container. This holds everything but the layout the same. From 16 writers, each commit synced before it is answered:
SQLite is never ahead. On the Mac one log for all looked worth having, a sync shared by every account's commits; on the runner, where syncs of different files go on side by side, it buys nothing from 16 writers and a fifth from 4. So the layout stays.
The last part found what the scale run does not, as it makes 2000 accounts without passwords: the start grows with the accounts (3.7 s for 100000 on the runner; on the Mac, four fifths of it deriving each account's public key), with the square of them once they have emails (115 s for 100000), and compacting the service log holds all of it in memory as parsed JSON, over the memory bound from 10000 accounts. Those are for pulls of their own, each with its check in the scale run first.
How it was checked
just store-benchhere, whole, twice;cargo fmt --checkandcargo clippy -- -D warningsinbench/store. Thestore-benchworkflow on this pull, atcb07f18: its log is the runner's section of RESULTS.md.Shortcomings
service.mjsand the write part know the service log's and the commit frames' formats: a change to either is a change here, and nothing but thestore-benchworkflow, which runs only on a change tobench/store/, would say so.