Repository navigation
feat(id): stress_mem memory profile — RSS per resident world, compaction spike (#13086) - #13224
Conversation
…ion spike (#13086) New world_bench profile measuring the #6304 scale program's memory axis: RSS per resident world at the selected stress tier (the tier's idle, active, and hot worlds restored through WorldCore::restore and held, RSS sampled between phases), and the peak additional RSS while compacting journals of 2,000 and 100,000 entries (recover via FileJournal::open, restore, hold resident, compact to the checkpoint-sized set). The generator's journal-entry construction is extracted verbatim into stress_world_entries so the profile restores exactly the worlds the generator materializes. Reference-laptop results (medians of 5 runs each) are recorded in the #6304 design's limits table: 21,011 B per resident world blended at 1x and 18,223 B at 10x, both tier resident sets fully held (no wall), and a compaction peak of 4.88 MiB over pre-op RSS at 2,000 entries and 89.41 MiB at 100,000 entries.
|
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 45 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. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1d58bb2b8
ℹ️ 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".
| let (_, peak) = rss_bytes()?; | ||
| let spike = peak.saturating_sub(rss_before); |
There was a problem hiding this comment.
Scope peak RSS accounting to the measured operation
rss_bytes() returns the process-lifetime VmHWM, not the peak since rss_before. Whenever fixture construction or an earlier benchmark reaches a higher RSS than the measured operation, this subtraction reports that earlier peak as the compaction spike. This can happen even with ID_BENCH_STRESS_MEM_PART=compact: fixture setup allocates both the full entry vector and serialized journal before the baseline, and both compaction sizes run in the same process. Reset peak accounting after fixture setup for each measurement, or sample RSS only within the measured interval, so the reported spike actually belongs to recovery/restore/compaction.
Useful? React with 👍 / 👎.
# Conflicts: # doc/2026-11-23T07-53-00Z_design_scale_perf_stress_v1/2026-11-23T07-53-00Z_design_scale_perf_stress_v1.md # pkgs/id/benches/world_bench.rs
Closes #13086 — the memory-profile slice of the #6304 scale & performance stress program (breakdown item 4).
What lands
stress_memprofile inpkgs/id/benches/world_bench.rswith two measurements:Createdheader each), active worlds, and hot world are restored through the realWorldCore::restorepath and held resident; RSS (VmRSS/VmHWMfrom/proc/self/status) is sampled between phases, so the line reports per-class marginals (idle / active / hot) plus the blended per-world number. A restore failure stops growth and is recorded as the tier's wall, per the design's run protocol.FileJournal::open, restore, hold resident,FileJournal::compactto the 64-entry checkpoint set the compaction bench uses. Spike = peak RSS during the operation − RSS just before it.ID_BENCH_STRESS_MEM_PART(all/compact/resident) runs one part per process when attribution matters; tier/seed follow the existingstress_genknobs.stress_world_entries, shared bystress_genandstress_mem. Verified character-identical to the original inline block (1,224 chars), andstress_gen --quickproduces the identical hot state hash (8ef2ffc8a61f687b) before and after.frame_costprofile and fix(id-bench): recover stress_gen after interrupted generation #13181's staging-publish generator change; both profiles coexist (9 registered benchmarks), and all numbers below were re-measured on the merged tree.Results — reference laptop (Ryzen 7 7840U, 123 GB RAM, NixOS), medians of 5 runs per measurement
Both tiers' resident sets are fully held — no wall at 1x or 10x on the reference laptop, and no eviction engages on the restore path (eviction lives in the hub/actor layer, not in
WorldCore::restore); resident-set growth is the phase progression above. Per-tier spread across the 5 reps was <1% on every headline number except the small 2,000-entry compaction spike (~±3%).Verification
cargo build --release --bench world_benchclean on the merged tree (only pre-existing warnings; none in the new code);cargo fmt --checkclean for the bench file.--quicksmokes on the merged binary:stress_gen(identical hot hash),stress_mem, andframe_cost(view fuel 958,616, matching id(phase-14): frame cost vs world state size — view fuel and wall time at 10k/100k/1M events #13085's recorded values) all pass.