Repository navigation
Description
Tier 2 patches open fast, then sit on a loading state for seconds. Switching screens inside a patch is just as slow. We measured this on production on Oct 17, using:
- the server's wide events;
- Neon's database statistics and object-storage logs;
- two Chrome Performance traces of the same six-query screen of a company patch.
This issue records what we found and tracks the fixes.
Two loads of the same screen
Reloaded right away (warm process). The last panel's data reached the page 6.6 s after the click, as seen in the trace. There were no 409s.
| When (s) | What happened |
|---|---|
| 0.16–1.10 | /~shell/broker.js, 294 KB, uncompressed and no-store |
| 1.14–1.86 | /~content/…: 228 ms to first byte, partly because the server re-reads the version's HTML from object storage on every load. Then 296 KB, uncompressed and no-store |
| 1.88–2.00 | A me round trip. Subscriptions wait for it |
| ~2.2–6.6 | The server runs 8 queries one after another for 6 panels |
Two of the 8 runs came after the shell's reconciliation replace POSTs, sent 1 s after the subscribes and again 2 s later. One query that was running when a replace arrived delivered no data and ran again. Another ran again after its answer had been sent.
After a minute idle. The trace ends at 6.1 s. The server log puts the last panel's query completing at about 6.7 s.
- The two big downloads finish by 1.06 s (375 ms to the content's first byte).
- Of the 5 subscription POSTs, 2 got
409, 2 got200, and 1 had no response. The shell reconnected the stream (1.21–1.77 s). - The first query ran on a freshly started process (1.05 s), and its result never reached the page. A second query's first result also never arrived. The server ran 8 queries one at a time from about 1.95 s.
Whether a result was discarded or simply not delivered isn't recorded today; #741 adds it.
Where a query's time goes
Past week, two production tier 2 patches:
- A query after its process's first run takes p50 504 ms, p90 710 ms (308 runs).
- Over all successful runs, the guest's whole run, including its callbacks, is p50 33 ms (
guestMs). - The company connection is held for p50 218 ms (
dbMs), which includes invoke hops and overlapsguestMs.
- Over all successful runs, the guest's whole run, including its callbacks, is p50 33 ms (
- The first observed subscription run in each process lifetime: 44 runs. 3 hit the 3 s
tier2.query.deadlineand failed. The other 41 took p50 1.12 s, p90 2.31 s. - A version's process is reaped 60 s after its last call, even while its page is open. 25 of 44 reaps happened while a document for that version was open.
- SQL execution appears small. Neon reports about 0.5 ms of execution per transaction, a 100% buffer hit rate, and a company database whose open transactions are mostly idle, waiting on the host. These aggregates can't attribute a single query's time, but they point at the work around the database rather than inside it.
- Per-call work, read from the code. Each call:
- reads the version's server bundle (216 KB) from object storage, p50 45 ms and p90 129 ms;
- re-sends it to the supervisor;
- makes two ECS
DescribeTaskscalls. For resource-backed queries, the second one happens while the company connection is held.
- All 10 company task binds that week found a spare, so cold task starts weren't a factor.
Fixes
First, independent wins:
- The shell re-sends the whole subscription set while the server is still answering it #742 The shell re-sends the whole subscription set while the server is still answering it
- A patch runs one query at a time per host #743 A patch runs one query at a time per host
- Company documents' subscriptions wait for a
meround trip #744 Company documents' subscriptions wait for ameround trip - Wide events don't show the subscription queue wait, discarded runs or subscription POSTs #741 Wide events don't show the subscription queue wait, discarded runs or subscription POSTs
- The shell script is re-downloaded uncompressed on every load #745 The shell script is re-downloaded uncompressed on every load
- Patch content is re-read from storage and sent uncompressed on every load #746 Patch content is re-read from storage and sent uncompressed on every load
- Each call re-reads its server bundle from object storage #747 Each call re-reads its server bundle from object storage
- Count and consolidate the platform-database work per call #748 Count and consolidate the platform-database work per call. This is a local investigation and can start any time
Then:
- Subscription POSTs get
409and the shell reconnects the stream #749 Subscription POSTs get409and the shell reconnects the stream. Blocked by Wide events don't show the subscription queue wait, discarded runs or subscription POSTs #741 - A
replaceoverlapping a run can throw away its result #750 Areplaceoverlapping a run can throw away its result - Each call re-sends the whole bundle to the supervisor #751 Each call re-sends the whole bundle to the supervisor. After Each call re-reads its server bundle from object storage #747
- Each call asks ECS where the task is, twice #752 Each call asks ECS where the task is, twice
- A version's process is reaped while its patch is open #753 A version's process is reaped while its patch is open. After Each call re-reads its server bundle from object storage #747 and Each call asks ECS where the task is, twice #752, which keep its warmups and touches cheap
Targets (models, not measured results): the first group should bring a warm screen like this one to about 2–3 s from click to the last panel. F and G are what get it under a second, including the first screen after a minute idle.
After each deploy, re-measure:
- re-run
durationMs,guestMsanddbMsdistributions; - per document, the time from desired-set admission to the first and last delivered snapshot;
- one Chrome trace of the same screen, both warm and after a minute idle.
Diagnosis by Claude Opus 5.5 in Claude Code; plan reviewed with GPT-6.1-Sol over two rounds.
Activity
replaceoverlapping a run can throw away its result #750meround trip #744409and the shell reconnects the stream #749feat(runtime): wide events show re-run queue waits, dispositions and …
perf(serving): company pages subscribe without waiting for who-am-I (#…
perf(patches): tier 2 calls reuse their server bundle instead of re-r…
perf(execution): calls reuse a verified task address instead of askin…
perf(execution): warm calls stop re-sending their server bundle to th…
perf(serving): a stream lost to a misrouted subscription reconnects a…
allisonmahmood commentedon Oct 19, 2026
Release 14 in production (measured 2026-10-19)
Sources:
Browser
~contenttransferServer, before → after
What's left
409and the shell reconnects the stream #749: misrouted subscription POSTs. Cause measured and posted there: the balancer's own cookie is wiped by every non-/api/runtimeresponse.