oliver-zehentleitner / maity
performance, hub: GET /me/notifications takes 2 s and over half of all DB time (counts over every unread item); …/events statement count
tsk-spa1tad26vs1 Done An agent
Report from Oliver (2026-11-10): "a fresh empty account is very fast; as soon as the account has project maity it gets slow, even with no maity tab open." q8q9 measured it on prod rev 29, all 4 pods, 07:00–07:30Z (maity_hub.timing, 101716):
| route | calls | share of all DB time | statements median / max | db_ms median |
|---|---|---|---|---|
| GET /me/notifications | 178 | 55.8 % (461 s) | 230 / 407 | 2141 |
| GET …/events | 1528 | 32.0 % (265 s) | 98 / 172 | 183 |
| GET …/members | 291 | 3.6 % | 59 / 66 | 82 |
/me/notificationstakes 2.3 s (median per the access log, min 572 ms). That's database work, not a long poll. The dashboard calls it on every page (web/js/notify.jsread():/me/notifications?limit=0, counts andby_projectcomputed over every unread item, §18.2). The cost grows with the caller's unread items across all projects, so a member of maity pays it on every page.- With one worker per pod, a 2 s call holds its share of the DB pool for that long. That may explain short stalls elsewhere; not established.
- Not established: the statement count per call (per unread item?) and which callers.
Scope:
- Reproduce: a test that counts statements for
/me/notifications?limit=0with N unread items over several projects. It's red on main if the count grows with N. - Make the counts and
by_projecta fixed number of queries (aggregate in SQL), with no change to what the answer contains (§18.2). Same check for…/events: why 98 statements median? - Report before/after numbers. q8q9 has prod samples and repeats the measurement after the deploy.
Priority: before tsk-ay4htr4s4w88. This is what Oliver feels on every page.
Notes
An agent · Nov 10, 2026, 07:34 UTC
Web step (separate from the hub PR): the counts read holds up every page's first draw.
web/js/app.js:2295(inrender) awaitsM.notify.read(), which reads/me/notifications?limit=0, inside the samePromise.allasloadContext(…)andprojectViews(me). Nothing of the page draws until all three answer, so a 2 s counts call is a 2 s page.ctx.refreshCounts(app.js:1828) awaits it together withGET /metoo, but that runs after the page is up.- Suggested step: take
M.notify.read()out of thatPromise.all. Start it, draw the page, and update the header (bell, chat button, tab title, switcher counts) when it answers.notify.jsalready callschanged()after a read. A failed read already leaves the page standing (notifyError). - Open question: whether the long call also slows other reads through the shared pool. One worker per pod, and up to 4 full answers at once (
AT_ONCE) each hold a pooled connection while they derive. This is not established.
The hub PR for this card makes the call itself cheaper (statement count no longer grows with traffic between agents, and
limit=0derives no item). The web step makes the page not wait for it.