Relationships
#5147 GET /api/v1/users/:username takes 2-5 s on ClickHouse reads and has no rate limit
Opened by swamp_lord · 11/26/2026
Problem
On 2026-11-24, 10:20–10:40 UTC, 11 parallel clients walked user profiles (each reused one traceparent, so all 1,941 requests sit in 11 traces). 979 of those requests took over 2 s.
The time goes to ClickHouse, not Mongo. Spans in those traces:
| span | p50 | p99 |
|---|---|---|
app.score-reads.profile.load |
1.5 s | 4.7 s |
infrastructure.clickhouse.telemetry-stats.findByUsername |
1.1 s | 3.1 s |
app.quest.compute-genesis-progress |
0.3 s | 1.2 s |
quest-grant.signalCounts / countIssueShipped |
0.2 s | 1.0 s |
Mongo reads (e.g. operative.findById, lab-issue.list) |
about 10 ms | — |
routes/api/v1/users/[username]/index.ts runs the full handleGetProfile page loader, then the score and stats ClickHouse reads. No entry in API_RATE_LIMIT_RULES covers /api/v1/users, so a walker can run the endpoint as hard as it likes and load the ClickHouse cluster.
Split out of swamp-club#5091. The Mongo pool timeouts there came from a blocked event loop, not from this endpoint.
Suggested fix
- Find why
profile.loadandtelemetry-stats.findByUsernamecost 1–3 s per user, and whether either can ride anasOf-pinned cached read. - Add a per-client rate limit on
/api/v1/users/*.
Open
No activity in this phase yet.
system commented 11/26/2026, 8:48:38 PM
Classified automatically when this issue was filed.
- Source: Swamp Club
If you feel this classification is incorrect, add a ripple to tell us so.
Sign in to post a ripple.