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

The forge holds 500 anonymous code pages a second, with people still fast #9499

opened this in answer to

Merged 27d 20h ago, live in production

This pull covers two of the six "done when" items: commit-pinned pages kept after the first read, and a repeatable load test with a 20% regression verdict. I did not do the other four. The earlier checks went red on a single timeout in the runtime-meter test (test/meter.test.ts).

Notes

opened this

This pull covers two of the six "done when" items: commit-pinned pages kept after the first read, and a repeatable load test with a 20% regression verdict. I did not do the other four. The earlier checks went red on a single timeout in the runtime-meter test (test/meter.test.ts). That test passes alone, and I found no cause in this change.

On this push I merged current main into the branch. The gate, tsc, design-lint and the tests below pass here; I didn't run the full suite, since the forge's check does that on push.

What changed

  • Pinned pages kept: an anonymous read of a blob or raw page at a full commit id is kept after the first read. The second read walks no git. This sits beside the existing tree cache in src/web/pages/tree_cache.ts, and the wiring is in blobPage and rawBlob in src/web/pages/repo.ts. Signed-in readers, private repositories, branch names and fragment requests bypass the cache.
  • Load test: bench/load.ts is a repeatable load test. src/perf/load_verdict.ts compares a run with the last kept result and fails if the rate falls more than 20%. How to run it is in docs/features/load-test.md.
  • Tests: test/anonymous-deep.test.ts and test/load-verdict.test.ts cover the cache and the verdict.

What I chose not to do

  • Profile on the issue: nothing is attached yet, and the issue asks for it before any fix.
  • Event loop: I did not move page rendering off the main thread.
  • 500 pages a second: I have not measured p95 at that rate, with or without the edge cache. The sandbox can only reach previews, not a separate load-test machine.
  • Release gate: the 20% check is not wired into the release check. It needs a kept baseline from a real run first.
  • Open questions: the issue's questions about what makes production slower and about the event-loop-lateness ceiling are unanswered.

How to try it

  1. On the preview, open /trevato/forge/tree/main twice and compare the second response time.
  2. Open a commit-pinned blob page twice and compare again. Open its raw page twice as well.
  3. Run bun bench/load.ts against the preview.

I'd split the rest into separate issues: the profile, moving the rendering off the main thread, and the 500-a-second run.

🤖 Generated with Claude Code

Closes #9405

2 earlier comments
commented

This pull covers two of the six "done when" items: commit-pinned pages kept after the first read, and a repeatable load test with a 20% regression verdict. I did not do the other four. The earlier checks went red on a single timeout in the runtime-meter test (test/meter.test.ts). That test passes alone, and I found no cause in this change.

On this push I merged current main into the branch. The gate, tsc, design-lint and the tests below pass here; I didn't run the full suite, since the forge's check does that on push.

What changed

  • Pinned pages kept: an anonymous read of a blob or raw page at a full commit id is kept after the first read. The second read walks no git. This sits beside the existing tree cache in src/web/pages/tree_cache.ts, and the wiring is in blobPage and rawBlob in src/web/pages/repo.ts. Signed-in readers, private repositories, branch names and fragment requests bypass the cache.
  • Load test: bench/load.ts is a repeatable load test. src/perf/load_verdict.ts compares a run with the last kept result and fails if the rate falls more than 20%. How to run it is in docs/features/load-test.md.
  • Tests: test/anonymous-deep.test.ts and test/load-verdict.test.ts cover the cache and the verdict.

What I chose not to do

  • Profile on the issue: nothing is attached yet, and the issue asks for it before any fix.
  • Event loop: I did not move page rendering off the main thread.
  • 500 pages a second: I have not measured p95 at that rate, with or without the edge cache. The sandbox can only reach previews, not a separate load-test machine.
  • Release gate: the 20% check is not wired into the release check. It needs a kept baseline from a real run first.
  • Open questions: the issue's questions about what makes production slower and about the event-loop-lateness ceiling are unanswered.

How to try it

  1. On the preview, open /trevato/forge/tree/main twice and compare the second response time.
  2. Open a commit-pinned blob page twice and compare again. Open its raw page twice as well.
  3. Run bun bench/load.ts against the preview.

I'd split the rest into separate issues: the profile, moving the rendering off the main thread, and the 500-a-second run.

🤖 Generated with Claude Code

commented

This round fixes the review points except the kept baseline, and I could not produce that. The cache bypasses are now tested, and the type, naming, escaping and compare-gate fixes are in.

What changed

  • Bypass tests (test/anonymous-deep.test.ts):
    • I read a pinned blob page and /raw as a stranger, then moved git away.
    • A signed-in reader is not handed the stranger's page. It goes to git and fails.
    • ?fragment=1 and a branch-name ref are not kept.
    • After the repository is made private, both the blob page and /raw are refused.
    • The stranger's own kept page still answers with git gone.
    • I did not run these against the pre-fix code to see them fail.
  • Types: cachedRaw and keepRaw now take BlobForRender. The cast is gone, and keepRaw skips missing and too_large.
  • blobPage: view and all are computed once and shared by the kept and unkept paths, so keptView and keptAll are gone.
  • bench/load.ts: repo is regex-escaped.
  • Compare gate test (test/load-bench.test.ts): it runs bench/load.ts against a stub server. It checks that --compare exits 1 with "LOAD REGRESSION" on a fall and exits 0 when the rate holds.
  • Media: docs/features/load-test.md now says media is not cached. The blob page that embeds it is.
  • Follow-up issues opened:
    • #9503: profile tree, blob, raw and media under a production-shaped copy.
    • #9504: commit the first baseline and wire --compare into the release step.
    • #9505: cache media pages.

What I did not do

  • No bench/results/ baseline. The preview holds no repositories, so there is nothing for the load test to read. I did not aim 500/s at production. The first baseline needs a run against a copy with data (#9504), and I can't say which machine ran it because nothing was run.
  • No profile (box 2). It needs the same data-bearing copy (#9503).
  • Release step that calls the verdict: none is wired yet. src/perf/load_verdict.ts is only reached through bench/load.ts --compare. Calling that from the release check is part of #9504.

Checks

  • tsc is clean. scripts/gate.ts printed nothing.
  • The three load/cache test files pass: 15 tests, 0 failures.
  • scripts/fast.ts named 1247 test files, so I ran only the files covering this change and left the full suite to the forge's check.

To try it

  • Run bun test test/anonymous-deep.test.ts test/load-bench.test.ts.
commented

Left #9405 open: 5 unticked items remain (A repeatable load test, run from a machine that isn't the owner's Mac against a copy of the forge, reports the rate and latency it reached, and its result is kept for each release.; A profile of a tree, blob, raw and media page names where each one's time goes under load, and is attached here before any fix is chosen.; Rendering a code page can't hold the main thread: signed-in pages stay under 200 ms at p95 while strangers read at full rate.; …).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs