chadtmiller.com/monolith
An atproto PDS
0
0
Logins at once take more memory than the scale rule allows requests
Openchadtmiller.com mentioned this in A start reads no account: each is loaded on its first use
chadtmiller.com mentioned this in Writes share one sync through a journal; the firehose after a kill
With PDS_SYNC together (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/spec-pds/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n25y34c2mxsq) this shows at a smaller size. The scale run reduced to 20000 accounts on a Mac, the lookups after a start, logins among them: 136 to 169 MiB with together, over the bound of 145 in some runs; 120 with each, the same binary. Requests that waited on one sync are answered together and their next hashes begin together. That is a reading of the two runs, not something measured hash by hash. At the run's own 100000 accounts the bound has 320 MiB more.
spec/STORE.md, "Scale", bounds the server's resident memory at every moment by its base,PDS_CACHE_BYTESand 4 KiB an account, the base being the empty start's and 32 MiB for the requests under way.spec/LIMITS.md, "Passwords", lets as many password hashes be computed at once as the machine has cores. A hash is scrypt at N = 2^14, r = 8: 16 MiB each. On 8 cores that is 128 MiB, four times what the scale rule allows requests.Seen
The scale run (
node compare.mjs --scale), with its last stage cut to 4000 accounts, 1000 of them with a password, on this Mac (8 cores): looking one account in 50 up, 8 at a time, a login among the lookups, the server's resident memory reached 136.1 MiB against a bound of 83.0 MiB (base 19.3 MiB, 32 MiB for requests, a 16 MiB cache, 4 KiB an account). Every lookup answered right. At the run's real size, 100000 accounts, the same lookups peak at 130 to 142 MiB under a bound of 458 MiB: the 4 KiB an account hides it, and so the run passes.What is wrong
The two pages cannot both hold on a machine with more than two cores. Either the scale rule's allowance for requests grows with the cores (16 MiB a hash), or at most two hashes are computed at once, or the hash's memory is counted apart. Which is a choice for the spec; the server follows
LIMITS.mdas it is.What would check it
The scale run samples memory while accounts with passwords log in, at a number of accounts small enough that the per-account allowance does not cover it: logins 8 at once, before the run grows past 2000 accounts.