Skip to content

bench(id): profile the fuel-spin isolation gap (#1067 slice 1) - #12572

Merged
dezren39 merged 4 commits into
mainfrom
felix/1067-fuel-spin-profile
Nov 22, 2026
Merged

dezren39 merged 4 commits into
mainfrom
felix/1067-fuel-spin-profile

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

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_isolation workload 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.rs and records the result:

  • The victim driver now records the same sample split many_worlds uses — (deadline-to-acknowledgement, driver wake lateness, input acknowledgement wait) — per phase.
  • The bench differences the victim actor's own journal-append and command latency histograms across each phase from its WorldHandle::metrics() snapshots, and prints one profile fuel_spin_isolation ... line per run.
  • BASELINES.md gains the profile section; the first attributed run's bench + profile lines are appended to baseline.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 three world_bench.rs warnings 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 (the fuel_spin_isolation driver 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 extra Metrics commands per run, outside the timed phases. Reverting restores the previous bench output exactly.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Update after merge-forward (2026-11-22)

Main moved while this PR was open, in ways that bear directly on it:

felix added 2 commits November 22, 2026 13:38
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.
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 14:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T14:22:59.795306Z 6aae239 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d21818af-218f-4530-9b64-e004aac3a588
Commits

Reviewing files that changed from the base of the PR and between 6bc7fe5 and 6aae239.

Files selected for processing: 3

  • pkgs/id/benches/BASELINES.md
  • pkgs/id/benches/baseline.txt
  • pkgs/id/benches/world_bench.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

felix added 2 commits November 22, 2026 14:03
…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.
@dezren39
dezren39 merged commit 666424e into main Nov 22, 2026
1 check passed
@dezren39
dezren39 deleted the felix/1067-fuel-spin-profile branch November 22, 2026 14:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant