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

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
88 lines · 4.5 KB Raw History

startup and storage benchmarks

History: dated optimization work on startup and Spaces storage, with the measurements taken at the time. The current benchmark methodology is in benchmarking.

2026-09-05: index commit CID lookups

The revision backfill runs on startup and matches NULL-revision blocks against commits by (did, cid). Without a matching index, unmatched historical tree blocks repeatedly scan an account's commit history. A non-unique composite index removes those scans without skipping backfill or integrity validation.

Five-run medians on macOS arm64, ReleaseSafe, warm filesystem. This initial fixture had block and commit history but no sequence-event payloads:

lanebeforeindexed
fresh schema22.00 ms22.34 ms
empty restart9.11 ms9.33 ms
history restart3147.59 ms15.38 ms
old history snapshot, including index creation—29.01 ms

These fixture results are not production startup timings. Before the change, Fly logs showed about 5 seconds from process launch to the listening message. An external one-second health probe with a two-second request timeout observed 8 consecutive timeouts spanning roughly 17 seconds during the prior deployment; that includes machine replacement and proxy routing, not just process startup.

sequence recovery

The first indexed production deployment still recorded storage_ms=5709. The fixture improvement alone did not establish a production improvement. Read-only production probes then identified another scan: computing the next sequence via MAX over a union of every commit and event sequence. That query scanned the event table (including its large row storage). Computing MAX(seq) inside each branch first preserves empty-table and gap semantics while letting SQLite seek to each table's final integer primary key. A production read-only comparison returned 10914 for both queries, taking 556 ms and 1 ms respectively; these are individual warm query measurements, not full startup measurements.

The history fixture now includes 10,000 events with 4 KiB payloads to exercise this path. Regression tests cover empty histories, either history being ahead, gaps, and an empty commit table with retained events.

narrow revision backfill to missing revisions

Production EXPLAIN QUERY PLAN showed SCAN repo_blocks for both backfill updates even after commit lookup was indexed. Unlike the read-only SELECT probes, UPDATE selected a full scan of payload-bearing block rows. A partial index on (did, cid) WHERE repo_rev IS NULL bounds subsequent backfill work to unversioned blocks. It is created after the legacy repo_rev column migration. Index creation still scans existing blocks once on upgrade; it does not remove or bypass migration work. The fixture now includes 4 KiB block payloads as well as events, exposing the cost of scanning payload-bearing tables.

With payloads in the fixture, five-run macOS ReleaseSafe median readiness fell from 33.86 ms (commit index only) to 9.22 ms (partial index plus per-table sequence maxima). Empty restarts measured 9.16 ms. These warm-cache results are distinct from the initial small-block comparison above.

September 2026: independent simplespace read/write access

On macOS arm64, Zig 0.16.0, ReleaseFast, three just bench space 1000 runs before and after the API/storage update gave these median throughputs:

storage operationbefore ops/safter ops/s
listSpaces56,05554,399
listMembers38,59637,099
createRecord7,3897,224
getRecord180,344174,748
listRecords44,60943,957
getRepo624628

These sequential local samples show small changes (roughly 1–4% on most read paths), not a production capacity estimate. The member list now returns two additional flags and space configuration reads return independent policies. At 10,000 records, a single export probe measured 69.0 ops/s before and 68.6 after; createRecord measured 7,016 before and 7,319 after. Membership size is not scaled with record count in this fixture.

A ReleaseSafe startup rehearsal on a consistent production SQLite backup preserved account, session, OAuth, public block, permissioned record, space configuration, and membership state. The migration stage took 10 ms locally; first readiness was 336 ms and a subsequent restart reached readiness in 11 ms. These are individual warm-filesystem samples, not Fly replacement or network interruption measurements.