Repository navigation
test(gate): measure admission under Worker suite contention - #177
Conversation
Quest-Claim: 470bfc40d20c751d
Add scripts/gate-bench.sh, which starts N Worker suites at once in detached worktrees, gated or bypassing the gate, optionally pinned to a few CPUs, and reports failed suites, 5-second timeouts, waits, run times, makespan, and peak load, CPU pressure, and least available memory. It also measures admission overhead against a bypassed call. The measurements finish the gate quest, so delete it and its links. Correct the README: waiters are admitted about 10 seconds apart, since a claim is refused while the previous window's claim exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outcome: I measured the gate with (Written by Claude Opus 5.5) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Merge summary:
Enabling auto-merge on (Written by Claude Opus 5.5) |
* docs(quest): plan gate admission with headroom Follow-up of the contention measurements in #177: admit at once while the host has room, fix the two-window spacing, a stable claim directory, backward clock steps, and forwarding Ctrl-C once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): address review of the gate headroom plan Count recent admissions against free memory as well as load, define the spacing band, require atomic minute-long admission records, and pin down the claim directory, clock-step, and Ctrl-C rules. The Ctrl-C fix covers `quest worktree run` only if #178 has landed. The quest is now [M]. Also fix the seed test path in the inbox-accuracy quest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): count unexpired gate records and survive large clock steps Derive the recent-admission count from unexpired records with a record-then-count step instead of slot numbers, which expiry leaves with holes. Rewrite a future-dated record's time to now rather than discarding it, so a large backward clock step still spaces admissions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): elect one gate admission at a time under a lock Record-then-count prevents over-admission but can livelock when a whole burst withdraws together. Suggest serializing prune, count, and record under a short host-wide lock reclaimed from exited owners. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): share the Ctrl-C fix with quest worktree run #178 landed, so the gate headroom quest fixes the double Ctrl-C in both commands unconditionally, and the worktree quest links to it instead of the planning PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): state gate admission as requirements and hazards Four review rounds kept finding edge cases in the prescribed records, lock, and clock-step mechanisms. Keep the decisions and the three-band rule, state what the admission mechanism must guarantee, and list every review finding as a hazard the implementation must test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): require a claim location stable across login sessions /run/user/<uid> comes and goes with logind sessions, so choosing by its existence can split callers again. State the requirement and the hazards instead of a directory rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(quest): keep forwarding SIGHUP from the gate A SIGHUP sent with kill to Quest alone cannot be told apart from a terminal hangup, so skip forwarding only SIGINT in the foreground group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Finishes quest/m0/local-gate.md: measures
quest gateunder representative build/test contention, now that load and memory admission landed in kixelated/quest#128.Changes
scripts/gate-bench.shmakes the measurement repeatable (run insidenix develop):gated|ungated <suites> [cpus]starts N Worker suites (bun run --cwd cloudflare test, the suite with 5-second test timeouts) at once, each in its own detached worktree, throughquest gateor bypassing it withQUEST_GATE_ADMITTED=1. An optionaltasksetCPU list oversubscribes a few cores without saturating a shared host. It reports failed suites, timeouts, admission waits, run times, makespan, peak load and CPU pressure, least available memory, and the most frequent failing tests. Worktrees are removed on exit.overhead [runs]timesquest gate truewith a fresh claim directory against the same call with the gate bypassed.quest rm).Measurements
Host: 24 CPUs, 61 GiB RAM, shared with other agent sessions. Background 1-minute load was 2 to 20 during these runs, shown as "load before". One Worker suite alone uses about 1 core for 17 to 20 s and peaks at about 650 MB RSS. One
just testuses about 1.2 cores for 30 s. Pinned runs confine N single-core suites to 4 or 2 CPUs, so "8×" means 8 suites per core.Every timeout in both 8× runs is the same test:
test/seed.test.ts > seeds a representative inbox through the Worker's own routes, which takes 514 ms alone.Admission overhead:
quest gate truetook 33 ms against 32 ms bypassed, and in a second run 43 ms against 40 ms, as medians of 20 runs each. Admission costs about 1 to 3 ms on top of CLI startup. The earlier 37 ms figure included the removed systemd probe.What it shows
/dev/shmand shared-runtime changes incloudflare/vitest.config.tslikely removed the earlier failures.So these runs do not support a responsiveness improvement claim on this 24-core host. The gate is cheap insurance for small hosts or saturated cores, and it costs about 10 s per queued command when a burst arrives.
Decisions
scripts/gate-bench.shin the repository, not wired into CI: the quest asked for a repeatable measurement, and the script is a load generator./quest-planfollow-up; this PR changes no admission behavior. Admitting immediately while the host is far below its limit would reverse the 2026-10-15 "no adaptive scheduler" decision; the narrower alternative is one admission per 5 s instead of about 10 s.Follow-ups
/quest-planthe burst-latency follow-up described under Decisions (adaptive admission, or fixing the spacing to 5 s).test/seed.test.ts"seeds a representative inbox" is the only timing-sensitive Worker test (514 ms alone). It is low priority because it needs about 8× oversubscription to fail; slim it rather than raising its timeout.XDG_RUNTIME_DIRuse different directories and do not see each other's claims. Derive it from the uid, for example/run/user/<uid>when it exists.gate-bench.sh overheadusesXDG_RUNTIME_DIRfor a fresh claim directory and would need another way.Validation
just checkandjust testpass in the Nix shell.shellcheckandshfmtcover the new script throughjust check.🤖 Generated with Claude Code
(Written by Claude Opus 5.5)