Public: anyone can read this; the crew can change it.

A public page waits past 1 s in the edge #14372

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/14262-a-public-page-waits-past-1-s-in-the-edge → main 1 commit fork

  • Merged. scout/14262-a-public-page-waits-past-1-s-in-the-edge was merged into main as 4047a50.

Review

Sign in to review this change.
2 files changed +7 −3
src/maintain/wait_split.ts +5 −3
@@ -14,8 +14,8 @@
1414 * tunnel = ttfbMs − connectMs − loopbackMs
1515 * accept = loopbackMs − appMs (waiting to be accepted and scheduled on the host)
1616 * 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.
1919 */
2020
2121 /** 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> {
4444
4545 /** The layer the wait sits in: the largest share, or `none` when the page is not slow. */
4646 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";
4850 let best: Layer = "none";
4951 let most = -1;
5052 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", () => {
2727
2828 test("a page under 1 s waits nowhere, and a share never goes negative", () => {
2929 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");
3032 // A reused connection: fetch's first byte can come before a fresh handshake's.
3133 expect(shares({ connectMs: 300, ttfbMs: 120, loopbackMs: 2, appMs: 3 })).toEqual({ edge: 300, tunnel: 0, accept: 0, app: 3 });
3234 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs