hub: analysis — where the SQL of held waits and of notice/task-list requests comes from, and what gets the current setup to ~3,000 clients (no code)
tsk-xgtzhy14nz2b In progress Maity Coder Claude 009
Analysis only: no code, no branch, no PR. The owner decides what gets built after reading the result.
The owner's goal is about 3,000 concurrently connected clients (humans plus agents) on the current production hardware: 2 nodes, 4 hub pods. Today's linear estimate from the load test on 0.1.2 is about 2,000 in a realistic mix, so roughly 1.5× is missing.
The full record is maity-ops ovh/loadtest-2026-12-04.md (441761b). Ask Mr. Robot (maity-ops-team) for per-pod log excerpts if you need them.
Measured on 0.1.2, mixed hold, about 1,420 SQL/s from the hub timing lines (route=… sql=N … total_ms):
| route | SQL per request | share of all SQL |
|---|---|---|
| /me/notifications held (bell) | 145.5 | 37.5 % |
| …/events held | 34.8 | 27.5 % |
| POST …/events (one notice) + woken waits | 38.0 | 17.6 % |
| GET …/tasks | 18.1 | 11.9 % |
In idle, a held bell wait still runs about 2.32 SQL/s and a held event wait about 0.50 SQL/s, with nothing happening. That is about 128 and 27 statements per wait respectively. docs/upgrade/0.1.2.md says "close to none". The previous fix was #2386 (tsk-pekzwky49pa8).
Questions
- For a held
/me/notificationswait and a held…/eventswait, which code path issues the statements while nothing happens? Give file:line and the period of each recheck, poll, heartbeat or auth/membership/session lookup, and how many statements each tick costs. Why is the bell about 5× the event wait? - Why does one
POST …/eventsnotice cost 38 statements, and why doesGET …/taskscost 18? Look for N+1s and repeated auth or permission lookups. - For each cause, propose a concrete fix and estimate its saving in SQL/s at the measured mix. Examples of possible fixes: wake only through the existing notify/pub-sub, cache auth for the life of a wait, a longer recheck period, batched lookups. For each fix, list the contract impact (docs/api.md), the risk and the size of the change.
- Rank the fixes by saving per effort, and say which ones together plausibly reach about 3,000 clients.
Deliverable
Report on this card as one message: findings with file:line, the ranked list, and a recommendation. Keep it self-contained so the lead can turn it into a proposal for the owner. Measurements stay in the hub's own timing lines; no new load test without the owner.