Linora

0803. Realistic load profile is the 100k acceptance default; ADR 0020’s mix becomes the stress profile

Status: Accepted (2026-11-28). Wave 3, realtime work package. Refines the load model of 0801; supersedes nothing. Code: tools/loadtest/ (profile.ts, worker.ts, report.ts).

Context

The 2026-11-27 100k runs used ADR 0020’s mix: 20% editors with cursors at a constant 20 Hz and 2 op batches/s, and viewers sending presence every 30 s. Even a quarter of that rate saturated the 5 gateway threads, and presence fan-out was 85-90% of frames out. Real sessions look different: most people in a file are watching, a cursor sends nothing while it rests, and peers only see cursors inside their viewport (ADR 0203 interest management). For wave 3 the coordinator set the product default: the 100k target uses a realistic activity profile. ADR 0020’s mix stays as a stress test that the server must survive without collapsing.

Decision

Profiles (--profile, default realistic):

  realistic (acceptance) adr0020 (stress)
rooms at 100k 20,000 x 3, 1,000 x 30, 10 x 1,000 (ADR 0020) same
editors 5%: 2 presenters per 1,000-room, 2 per 30-room, 1 in 2,980 of the 3-rooms 20%: 2 / 6 / 1 in 13,980
editor cursors bursts: moving U[2,5] s at 20 Hz, then idle U[3,15] s, sending nothing (28% duty) constant 20 Hz
editor ops 0.5 batches/s of 5 ops (same mix: 10% structural, 5% deliberately invalid) 2 batches/s
selection a change every ~10 s every 5 s
viewers one viewport on join, then a ~1 s pan burst (viewport + cursor at 20 Hz) every ~60 s cursor + viewport every 30 s
where people look editors in the room’s region 0; each viewer in region 0 with p = 0.5 (0.9 in 1,000-rooms), else regions 1-3 everyone in region 0
offered at 100k 59k presence msgs/s in, 2.5k batches/s (12.5k ops/s), 42k op sends/s, ~243k presence frames/s out (estimate) 403k presence msgs/s in, 40k batches/s (200k ops/s), 444k op sends/s, ~1.19M presence frames/s out

Every flag can override a profile default (--editor-share, --medium-editors, --batches, --move-on 2-5, --move-off 3-15, --viewer-pan-s, --viewer-pan-burst-s, --in-view, --in-view-large, --selection-s, --viewer-presence-s).

Geometry carries the latency. Interest management relays a cursor only to viewers whose viewport (grown by PRESENCE_VIEW_MARGIN = 0.2) contains it, so presence timestamps can no longer be raw coordinates. Regions are 10,000 x 10,000 page units laid out every 20,000 on x, so no margin reaches a neighbour. A cursor sent at run time ms in region rx is x = rx * 20000 + ms mod 10000, y = floor(ms / 10000) mod 10000. That is f32-exact, wraps every 27.7 h and has whole-ms resolution (reads up to 1 ms high). Viewports are region-aligned; pans jitter by at most 500 units. Ops keep ADR 0801’s timestamps. Room membership in regions is a deterministic hash, so runs repeat.

Client behaviour matches the wave-3 sync client. Every client sends its viewport once it is live. After busy/rate_limited on clientSeq j, the generator resends only j after the server’s retryAfterMs, and the rest in order once j is ACKed.

Acceptance per profile (report.ts):

Alternatives

Consequences