Repository navigation
bench(id): profile the fuel-spin isolation gap (#1067 slice 1) - #12572
Conversation
The fuel_spin_isolation workload recorded the F12.10 exit gap (victim p99 ratio 2.517 vs target 1.10, 2026-11-10) but not where the spinning phase's added latency sits. The victim driver now records the same sample split many_worlds uses — deadline-to-ack, driver wake lateness, input acknowledgement wait — and the bench differences the victim actor's own journal-append and command latency histograms across each phase from its metrics snapshots, printing one profile fuel_spin_isolation line per run. Measurement only: no scheduler, quota, or back-pressure behavior changes, and the bench line is unchanged.
Two attributed laptop runs (main 63f9558 + the profile instrumentation, heavy shared fleet load) plus a fresh unattributed gap measurement at unmodified main (ratio 17.043, vs the 2026-11-10 reference 2.517 at lighter load). The spinning phase's victim p99 is its driver's wake lateness (18.929 of 21.924 ms; 13.092 of 13.114 ms): synchronous guest burns occupy every shared-runtime worker. The victim's own service is negligible (command mean 55 -> 130/64 us, queue depth max 0, no journal appends in this workload). First bench+profile lines appended to baseline.txt; the 2026-11-10 reference line is unchanged.
Codex Review Summary: ✅ CompletedThis 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. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…profile # Conflicts: # pkgs/id/benches/BASELINES.md
Two back-to-back pre/post pairs on the laptop at light ambient load (full profile, same command): ratios indistinguishable (pre 6.049/6.711, post 6.826/6.085), wake tail persists, ack p99 worsens (3.963/6.456 -> 12.983/17.242 ms), and the victim's own spinning-phase command mean rises ~20x (67/103 -> 1,651/2,191 us, bucketed p99 2,000 -> 50,000 us) because every guest call now pays the block_in_place round trip under core saturation. Placement cannot create CPU; the supported next lever is admission - bounding concurrent guest burns. Pair lines appended to baseline.txt.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6aae23928f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # load (load average ~20-24), so the ratio is not comparable to the 2026-11-10 reference | ||
| # above - the attribution is the result: the victim's spinning-phase p99 is its driver's | ||
| # wake lateness (18.929 of 21.924 ms), not its own service. See BASELINES.md. | ||
| bench fuel_spin_isolation unit=ms_per_command median=2.992 min=0.222 reps=1 victim_p99_ms_calm=1.894 victim_p99_ms_spinning=21.924 ratio=11.575 target_ratio=1.10 target_met=false calm_samples=300 spinning_samples=300 spins=1059 spinners=15 phase_ms=3000 commands_per_second=100 spin_fuel=20000000 calm_elapsed_secs=3.041 spinning_elapsed_secs=3.139 |
There was a problem hiding this comment.
Keep diagnostic runs out of the machine-readable baseline
Appending these runs introduces duplicate bench fuel_spin_isolation records alongside the existing reference measurement. .github/scripts/id-bench-compare.sh explicitly treats duplicate benchmark names as malformed rather than selecting a reference; running it against this baseline reproduces fuel_spin_isolation ... incomparable (malformed bench line). Consequently, the comparison step in .github/workflows/id-bench.yml can no longer report regressions for this workload. Keep the historical runs in BASELINES.md or a separate capture file, leaving exactly one active baseline record for this benchmark.
Useful? React with 👍 / 👎.
Summary
Slice 1 of #1067 (F12.10 fair scheduling and per-account quotas), cut per the feature-slice skill: for a missed performance target the first slice is the profile. The
fuel_spin_isolationworkload already measured the exit-criterion gap (victim p99 ratio 2.517 vs target 1.10, recorded 2026-11-10) but could not say where the spinning phase's added latency sits.This PR adds the attribution to
pkgs/id/benches/world_bench.rsand records the result:many_worldsuses — (deadline-to-acknowledgement, driver wake lateness, input acknowledgement wait) — per phase.WorldHandle::metrics()snapshots, and prints oneprofile fuel_spin_isolation ...line per run.BASELINES.mdgains the profile section; the first attributed run's bench + profile lines are appended tobaseline.txt. The 2026-11-10 reference line is unchanged. No production code changes; the bench line format is unchanged.Result: the gap is runtime worker starvation, not victim service. In two attributed runs the victim's spinning-phase p99 was its driver's wake lateness (18.929 of 21.924 ms; 13.092 of 13.114 ms). The victim's actor is starved the same way (ack p99 0.2 → 5.086 / 4.007 ms) while its own service stays nearly free (command mean 55 µs calm → 130 / 64 µs spinning; queue depth max 0; no journal appends in this workload). Fifteen spinners run synchronous fuel-limited guest calls on the shared multi-thread runtime, occupying every worker for each burn — the #557 worker-parking disease in CPU form. The remedy is placement (guest execution off the shared workers), which is the next slice.
Criteria state on #1067 after this PR: exit benchmark — measured, target unmet, now attributed; fair hub scheduler — unimplemented, first fix step named by the profile; per-account quotas (worlds/storage/fuel-per-second) — unimplemented; slow-client back-pressure — unimplemented.
Evidence
All runs on the laptop (AMD Ryzen 7 7840U, reference machine), bench built via
~/tools/fleet-build-lock cargo bench --bench world_bench --no-run, run as./target/release/deps/world_bench-<hash> --only fuel_spin_isolation(full size: 15 spinners, 20M spin fuel, 300 samples/phase). The laptop was under heavy shared fleet load throughout (load average ~16–30), so ratios are not comparable to the 2026-11-10 reference (2.517 at lighter load); the attribution is the transferable result, and both attributed runs agree on it.Before (unmodified main
63f9558b9, fail-before): the run prints only the bench line — no profile line exists. Fresh gap:victim_p99_ms_calm=2.239 victim_p99_ms_spinning=38.168 ratio=17.043 target_met=false, 1,473 spins.After (this branch, two runs):
ratio=11.575— profile:spinning_wake_p99_ms=18.929 spinning_input_ack_p99_ms=5.086 calm_command_mean_us=55 spinning_command_mean_us=130 victim_queue_depth_max=0, 1,059 spins.ratio=6.888— profile:spinning_wake_p99_ms=13.092 spinning_input_ack_p99_ms=4.007 spinning_command_mean_us=64, 1,822 spins.Full lines are committed in
BASELINES.md/baseline.txt. The touched package's suites are unaffected (bench-only change; the bench compiles with no new warnings — the threeworld_bench.rswarnings at lines 230/235/707 pre-date the change). Suite-registry check for the bench path prints nothing, as required (no new test file; the bench is the registered suite).Merge Danger
None to production behavior: the change is confined to
pkgs/id/benches/world_bench.rs(thefuel_spin_isolationdriver records two extra timestamps per sample and three metrics snapshots per run; all existing assertions unchanged) plus the two bench record files. The victim in this workload now receives three extraMetricscommands per run, outside the timed phases. Reverting restores the previous bench output exactly.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Update after merge-forward (2026-11-22)
Main moved while this PR was open, in ways that bear directly on it:
run_guest_call: guest calls underblock_in_placeinsandbox.rs), landed explicitly "awaiting reference-machine bench". This branch merged main forward (conflict inBASELINES.mdresolved keeping both appended sections, including the CI-runner noise note, which says the 4-vCPU runner venue cannot decide the fix).BASELINES.md("Post-id-worlds: guest calls in blocking context — first #1067 fair-scheduling slice (draft, awaiting reference-machine bench) #12571 check") andbaseline.txt. Verdict: the fix does not move the ratio (pre 6.049 / 6.711, post 6.826 / 6.085) and taxes the victim's own calls — spinning-phase command mean 67 / 103 µs pre → 1,651 / 2,191 µs post (~20×, both pairs), ack p99 3.963 / 6.456 → 12.983 / 17.242 ms. Placement cannot create CPU; the lever the evidence now supports is admission (bounding concurrent guest burns), which is also the quota hook. The next-slice statement in the issue note is corrected accordingly.