Public: anyone can read this; the crew can change it.
A public page waits past 1 s in the edge #14372
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14262-a-public-page-waits-past-1-s-in-the-edge → main 1 commit fork
2 files
changed +7
−3
src/maintain/wait_split.ts +5 −3
| @@ -14,8 +14,8 @@ | ||
| 14 | 14 | * tunnel = ttfbMs − connectMs − loopbackMs |
| 15 | 15 | * accept = loopbackMs − appMs (waiting to be accepted and scheduled on the host) |
| 16 | 16 | * app = appMs |
| 17 | * The layer is the largest share; a page whose public answer is under `SLOW_MS` waits nowhere. | |
| 18 | * Plain data in, plain data out. | |
| 17 | * The layer is the largest share; a page whose public answer is under `SLOW_MS` waits nowhere, | |
| 18 | * whatever its handshake took. Plain data in, plain data out. | |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | /** Under this a warm public GET is not slow: #13633's bar, 1 s. */ |
| @@ -44,7 +44,9 @@ export function shares(t: Timings): Record<Exclude<Layer, "none">, number> { | ||
| 44 | 44 | |
| 45 | 45 | /** The layer the wait sits in: the largest share, or `none` when the page is not slow. */ |
| 46 | 46 | export function waitLayer(t: Timings): Layer { |
| 47 | if (pos(t.ttfbMs) < SLOW_MS && pos(t.connectMs) < SLOW_MS) return "none"; | |
| 47 | // The page is what is timed: the handshake is a separate fresh connection, so one slow handshake | |
| 48 | // beside a public GET under the bar is not a slow page (#14262). | |
| 49 | if (pos(t.ttfbMs) < SLOW_MS) return "none"; | |
| 48 | 50 | let best: Layer = "none"; |
| 49 | 51 | let most = -1; |
| 50 | 52 | for (const [layer, ms] of Object.entries(shares(t)) as [Exclude<Layer, "none">, number][]) { |
test/maintain-wait-split.test.ts +2
| @@ -27,6 +27,8 @@ test("each layer is named by the largest share of the wait, by hand", () => { | ||
| 27 | 27 | |
| 28 | 28 | test("a page under 1 s waits nowhere, and a share never goes negative", () => { |
| 29 | 29 | expect(waitLayer({ connectMs: 200, ttfbMs: 341, loopbackMs: 2, appMs: 1.1 })).toBe("none"); |
| 30 | // #14262: a slow separate handshake beside a 492 ms public GET is not a slow page. | |
| 31 | expect(waitLayer({ connectMs: 1586, ttfbMs: 489, loopbackMs: 3, appMs: 8.1 })).toBe("none"); | |
| 30 | 32 | // A reused connection: fetch's first byte can come before a fresh handshake's. |
| 31 | 33 | expect(shares({ connectMs: 300, ttfbMs: 120, loopbackMs: 2, appMs: 3 })).toEqual({ edge: 300, tunnel: 0, accept: 0, app: 3 }); |
| 32 | 34 | }); |
new above
offline