chadtmiller.com/monolith
An atproto PDS
The server outgrows its memory bound writing a repository of 100000 records
OpenThe same cause as at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2446s6uvtsq found for space repos: on main an account's log is compacted only past its checkpoint's size (store.rs policy, cap: None), and the account being written is never evicted, so its memtable grows with the repository. That pull's compaction for what the memtable counts (cache.rs, disk.mem.cost() > ctx.cache.memtable()) counts a repository's blocks and paths too, so it should fix this. Once it lands: node compare.mjs --scale on harness/getblocks merged with main, alone; if it holds the bound while the 100000 records are written, that branch's getBlocks check lands and LIMITS.md "getBlocks" leaves UNCHECKED.
spec/STORE.md, "Scale", says the server's resident memory is at every moment at most its base, plusPDS_CACHE_BYTES, plus 4 KiB an account, and that "holding, reading or writing a repository of any size stays within the bound". Writing one repository of many small records does not.Seen
node compare.mjs --scalewith thegetBlockscheck of branchharness/getblocks, which writes 100000 records of about 40 bytes to one account byapplyWritesof 200 (harness/checks/scale.mjs,writeWide), sampling the server's RSS every 20 ms, withPDS_CACHE_BYTES16 MiB and 2000 accounts:The same run's 64 MiB repository of 560 records of 120 KB stays within the bound (60 to 62 MiB); so do the
getRepoof it and the firehose replay.Where to look
Not measured: what the server holds of an account between folds of its log grows with the writes since the last one (
crates/pds-server/src/checkpoint.rs, thememblocks, paths and events), and 100000 small records are some 130000 blocks.Done when
node compare.mjs --scaleonharness/getblockspasses, with the memory bound held while the 100000 records are written; then that branch's check ofgetBlockslands, andLIMITS.md"getBlocks" leavesharness/spec-coverage.mjs'sUNCHECKED. A change to how the server stores runsjust nightlyhere too (AGENTS.md).