Skip to content

Tier 2 pages take about 7 s to show all their data: diagnosis and fixes #754

Open
15 of 16 issues completed
Open

Description

@allisonmahmood

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 got 200, 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 overlaps guestMs.
  • The first observed subscription run in each process lifetime: 44 runs. 3 hit the 3 s tier2.query.deadline and 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 DescribeTasks calls. 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:

Then:

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, guestMs and dbMs distributions;
  • 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.

Sub-issues

Sub-issues

15 of 16 Issues completed
Loading 16 sub-issues

Activity

  1. added
    area:server
    on Oct 17, 2026
  2. allisonmahmood commented on Oct 19, 2026

    @allisonmahmood
    OwnerAuthor

    Release 14 in production (measured 2026-10-19)

    Sources:

    • Browser: Performance traces of a full HQ load and of a screen switch after 2 idle minutes, compared with the Oct 17 traces.
    • Server: wide events from the ~11.5 h since the deploy (2 viewers, small sample), compared with the week before it.

    Browser

    Oct 17 Release 14
    Patch frame requested 0.98 s (broker.js download, 954 ms) 0.14 s (broker.js from cache by hash)
    Shell and frame visible 1.74 s 0.34 s
    Every panel filled ~6.5 s ~1.4 s
    Reconnecting toast during load yes, at ~4.9 s no
    ~content transfer 296 KB 106 KB (br)
    Screen switch after 2 idle min — one call, 123 ms; drawn 183 ms after the click

    Server, before → after

    • First runs (what a screen waits for):
      • p50 470 → 124 ms;
      • p90 863 → 450 ms;
      • over 1 s: 37/454 (8%) → 3/182 (1.6%);
      • timeouts: 3 → 0.
    • Database time per run: p50 192 → 64 ms.
    • Later runs: p50 451 → 131 ms.
    • Idle reaps while the patch was open: 33 of 51 → 0 of 2. An HQ tab left open overnight kept its process for 10 h (152 calls served).
    • Mutations: a small mutation took 132 ms end to end, of which ~100 ms was its own work. Before, a similar mutation took 423–1,144 ms for ~60 ms of work.
    • Server bundle: every run found it in memory, and none rebound.
    • Content: every response was br; server time p50 160 → 15 ms.
    • broker.js: 293,846 → 89,881 bytes.

    What's left

    • Subscription POSTs get 409 and 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/runtime response.
    • Slot wait: HQ Today's 6 first runs go 2 at a time, and the last one waited ~700 ms for a slot. That's the biggest remaining piece of the ~1.4 s.
    • Tabs open across a deploy: such a tab isn't re-warmed. After this deploy, the touches found no process for 29 minutes, until the next call loaded one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:server

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions