Repository navigation
feat(data_plane): SSD offload on by default, with a memory-pressure warning - #5151
ZhiyuLi-Nvidia merged 13 commits into
Conversation
05d11cf to
ab34fb5
Compare
zyzhou5
left a comment
There was a problem hiding this comment.
Do we have test for the impact of turning on SSD offload by default when it does not exceed threshold?
b702c4f to
4cecf0b
Compare
Two kinds now. The functional variants
Run-to-run spread of one configuration is about 10 GB/s on put and 20 on reads; the tier on against off is inside it for both backends, with 0 mismatches of 16,384 rows per step everywhere. For scale, the same workload under pressure (about 94 GiB pinned per unit, half of each step on SSD): nixl put 54 / 56 / 59 GB/s with 601 to 961 spills per unit and 0 failures; Mooncake put 11.3 / 11.0 / 9.0 with 76 waits, none to a deadline. |
4cecf0b to
9ee9223
Compare
9ee9223 to
17fc21f
Compare
terrykong
left a comment
There was a problem hiding this comment.
This PR turns on the SSD tiers of both data-plane backends by default (Mooncake ssd_offload, nixl ssd), puts their folders on the node's NVMe when path is null, and logs each backend's memory and spill counters every step, with a one-time warning at the first spill.
Thanks for the A/B data in the thread, and for a clean design: the local_disk helpers are pure and testable through mounts_text, require_disk_backed runs on the node that owns the folder, both drivers share one backend_health_metrics, and ray.sub mounts a per-user NVMe folder.
C1 is a CI break: please fix it before merge.
- (C1)
grpo_syncreadsdata_plane["backend"], which thegrpo_train_synctest mocks lack: 51 L0 unit tests fail withKeyError. - (C3) Low severity: nixl picks its default SSD folder on the node that starts TQ, unlike its own rule and Mooncake;
NixlSsdConfig.dir()is unused. - (C4) The default SSD folder name is shared by all users on a node, so a second user's run fails with
PermissionError. - (C5) The
nixl_ssdfunctional variant now has a 256 KiB put area, double what it was written for. - (C6) The 6 new Mooncake metric names copied from C++ are not checked against the shipped binary.
- (C7) A new test asserts field defaults, which the testing skill says not to do.
- (C8) The single-controller docstring's first line still says "No-op unless observability is enabled."
- (C9) "16 GiB pinned per unit" is now 20 GiB at the default.
- (C10) The README checkpoint section still calls hard-pinned replicas the default.
- (C11) The new README section explains code instead of usage.
- (C12) The
MASTER_METRICScomment narrates measured runs, which the repo's comment rule moves to the commit message. - (C13) Import order (ruff I001), formatting, and a missing pyrefly.toml entry.
- (C14)
simple.ssd_offloadstill requires a typedpath; give it the same node-NVMe default as the other two tiers.
All five of zyzhou5's threads are addressed at this head; we have nothing to add there.
GPU and RDMA tests and the L1 scripts were not run for this review (no GPU machine). The CPU unit tests were.
Generated by Claude Code
17fc21f to
4ac456c
Compare
4ac456c to
6c5446b
Compare
e292d50 to
5e1224e
Compare
|
/ok to test 5e1224e |
|
/ok to test 01387eb |
11fa6bc to
d17e2b1
Compare
|
/ok to test d17e2b1 |
d17e2b1 to
bc12d08
Compare
|
/ok to test bc12d08 |
…arning mooncake_cpu.ssd_offload and nixl.ssd are on by default. Both spill only when memory is full (above offload_threshold; when a unit's put area is full), so while memory suffices nothing is written and the default costs nothing. simple.ssd_offload stays off: it is by value size, so every value >= threshold_bytes would always go to SSD. The first spill of a run logs one warning that names the volume and the trade-off (reads of spilled data wait for the SSD) and the knobs to raise: - nixl: from the driver, in tq_nixl.unit_metrics(), when ssd_spills_sum first rises above 0 (new ssd_spilled_mb_sum beside it). - mooncake: from each segment owner's 30 s sweep, which already walks the offload directory; sweep_cleared_files() now returns what it saw (Sweep: removed, files, bytes). path defaults to a node-local directory under /tmp. An owner refuses a RAM-backed path (tmpfs, ramfs) at the point it creates the directory (nemo_rl/data_plane/local_disk.py), since spilling into RAM would consume the memory the tier is meant to relieve. require_offloading_store() runs only for the mooncake backend; install() keeps per-process state and the guard is mooncake's. Tests: the stubbed mooncake tests say ssd_offload.enabled=false (TQ is stubbed, there is no store to swap); the shared mooncake session client too, since the test process also holds the simple client and TQ builds one store per process. New tests: defaults on; path=None refused; tmpfs refused; sweep statistics. Verified on GB300 with the real single-controller recipe (2 nodes, 3 steps, exit 0 each): mooncake_cpu and nixl with recipe defaults (offload on, no spill, no warning); nixl with a 64 MiB slab and mooncake with a 64 MiB segment and offload_threshold 0.02 (spills, one warning each, in the driver for nixl and per owner for mooncake). Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
`mooncake_cpu.ssd_offload.path` and `nixl.ssd.path` default to null, which
resolves on the node that creates the directory (local_disk.default_ssd_dir):
/raid/<name> when /raid is in /proc/mounts, not RAM-backed and writable by
the process (DGX nodes mount the NVMe RAID at /raid), else /tmp/<name>. The
tmpfs check still runs on the result. An explicit path must be absolute, as
before; the "enabled requires a path" rule is gone since null is a path now.
Two facts from the GB300 experiment shaped the rule. os.path.ismount("/raid")
is False inside an enroot container, because the container root itself lives
under /raid (same device as /), so the check reads /proc/mounts. A stock
/raid is root-owned (drwxr-xr-x): the first version resolved to it and the
owners died with PermissionError, so the directory must be writable, and the
default falls back to /tmp otherwise.
Verified with the real single-controller recipe (2 nodes, forced spills,
path null): /raid root-owned -> PermissionError before the writability rule;
/raid writable (a writable NVMe dir bind-mounted at /raid) -> nixl exit 0,
67 blobs spilled, directory gone at shutdown; mooncake exit 0, 6 owners under
/raid/nrl_mooncake_ssd_offload, 1027-2447 objects offloaded per owner
(17,416 files / 190 MB on the host NVMe mid-run), directories gone at exit.
Control without /raid: exit 0 under /tmp. Unit: 350 passed (two failures are
the open-file-count race fixed in #5150's last commit).
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Zhiyu Li <[email protected]>
…r run
The single controller reads the Mooncake master's /metrics every step and
logs data_plane/mooncake/{mem_used_mb, mem_capacity_mb, mem_used_ratio,
keys, offloaded_keys_total, offloaded_mb_total, disk_evictions_total},
the way it logs nixl's unit metrics. The metrics URL travels in the TQ
MooncakeStore config block, so the controller finds it in whichever
process it runs in. The first step with offloaded objects logs one
warning per run, with the volume, the memory use and the knobs; before,
each segment owner's sweep warned once (6 warnings on 2 nodes), and the
sweep's only job is deleting files of cleared keys again.
offloaded_* are the master's "evicted from memory" counters. With the
master flags this module sets (offload on eviction, no forced eviction)
every such object went to its owner's SSD: on the 2-node forced-spill
recipe the counter reached 34,693 objects / 232 MiB over 3 steps, and the
same recipe had 17,416 offload files on one of the two nodes mid-run.
Verified: unit 306 + 52 passed; real recipe (2 nodes, 64 MiB segments,
offload_threshold 0.02): exit 0, one warning from the SingleControllerActor,
the seven metrics logged for steps 1-3.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: Zhiyu Li <[email protected]>
…SSD tiers The SSD tiers are on by default now, so the plain mooncake_units and nixl recovery variants run the defaults (path null, the node's NVMe) and fail if anything was spilled: nixl ssd_spills_sum == 0, mooncake offload_rounds_total == 0 and disk_evictions_total == 0, and the mooncake owners must log the default offload directory. The forced-spill variants (mooncake_cpu, nixl_ssd) drop their now-redundant enabled=true and mooncake_cpu also checks offload_rounds_total > 0 from the per-step metrics. The Mooncake metric names changed with what the master can tell: it has no per-object offload counter, and past the threshold with memory to spare it writes SSD copies but keeps the memory copies (the forced-spill test: 112 files, 11 eviction rounds, 0 memory copies dropped). So the single controller logs offload_rounds_total (rounds that wrote to SSD; the warning trigger) and mem_evicted_keys_total / mem_evicted_mb_total (memory copies dropped, whose reads go through the SSD) instead of an "offloaded objects" count. Verified on GB300 (one node, Qwen3-0.6B, RDMA): mooncake_units, mooncake_cpu, nixl and nixl_ssd recovery variants all pass; the forced-spill mooncake variant logged offload_rounds_total 12 / 8 across its two phases and one warning per phase. Unit: 306 + 52 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…te when the tiers fall back to /tmp ray.sub mounts a per-user directory at the container's /raid, so the SSD tiers' default lands on the node's NVMe without a config: NRL_NVME_DIR when set (for example /raid/scratch/$USER on a cluster whose RAID root is root-owned), else /raid/$USER, created on every node where its parent is writable (a bare-metal DGX whose user owns /raid, or a site that provides the directory). The source is never the shared RAID root, so two users on one node cannot collide on /raid/nrl_*. No writable directory: no mount. When /raid is not usable in the container the driver logs one note per run (not mounted / RAM-backed / not writable) with what /tmp is, e.g. "ext4 mounted at /", so a user can tell a harmless case (an enroot container whose /tmp is the NVMe RAID) from one that needs the mount or an explicit path. The note comes from the TQ bootstrap on the driver only. Verified on GB300, 2 nodes: defaults with no NVMe env -> exit 0, one note; NRL_NVME_DIR=/raid/scratch/$USER with forced spills -> ray.sub created the directory on both nodes and mounted it, no note, 67 blobs spilled under /raid, exit 0. Unit: 308 + 52 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
- nixl: the IO area is pinned beside the slab instead of carved from it, so turning the tier on by default no longer shrinks the put area (16 -> 12 GiB before) or changes max_blob_bytes; a unit with the tier on holds unit_slab_bytes + staging_bytes. ssd_config accepts any staging_bytes > 0. - Mooncake offload_threshold default 0.5 -> 0.8: with the tier on by default, 0.5 offloaded half of the memory's worth of data early. - ray.sub lists the per-user /raid mount before the user's MOUNTS, so a bind of their own at or under /raid (such as /raid/scratch) stays visible. - The backend's own counters (nixl unit metrics, Mooncake master metrics) and the one-time spill / offload warning are logged by grpo_sync too, through one helper, observability.backend_health_metrics, that the single controller also uses. - Tests keep the put-area / IO-area geometry by sizing the slab as the put area; the staging_bytes upper-bound check is gone. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…default Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
- grpo_train_sync test mocks set data_plane.backend, which the step's metrics call now reads (51 L0 tests failed with KeyError). - The default SSD folder is per user (<name>-<uid>): the first run created it 0755, and a second user's run on the same node failed at start. - nixl resolves a null ssd.path in each unit, on its own node, like Mooncake; ssd_config passes ssd_enabled and the raw path, and the unused NixlSsdConfig.dir() is gone. - simple.ssd_offload gets the same node-NVMe default for path: null (enabled stays false); the overlay sends the resolved folder since TQ rejects an empty path. - nixl_ssd functional variant: 128 KiB put area + 128 KiB IO area again, since the IO area is now pinned beside the slab. - The Mooncake binary-name test checks every MASTER_METRICS name. - Config test asserts dir() resolution only, not field defaults. - Docs: single_controller docstring no longer says "No-op unless observability is enabled"; "16 GiB pinned" is now "16 GiB put area; 20 GiB pinned with the default SSD tier" (interfaces, yaml, design doc); the README checkpoint section names the non-default hard-pinned case; the README offload section is usage only, and the nixl sentence moved to the design doc; MASTER_METRICS comment keeps the why only (the measured runs: 11 rounds / 112 files with 0 memory copies dropped past the threshold with memory to spare; 34,693 objects dropped under pressure). - Import order in tq_nixl and nixl_storage_unit; local_disk.py in pyrefly. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…, now the default The minimize-check lint hook rejects a recipe value equal to its base. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
… SSD offload on With SSD offload on by default, a mooncake_cpu client that owns memory swaps TQ's store class before attaching, and the guard after attaching checks that the swapped class was built. The GDR tests faked the attach with a no-op, so no store was ever built and the guard raised. - Move the fake_store fixture (recording fake Mooncake store, fresh offload state) from test_mooncake_ssd_offload.py to conftest.py. - The GDR tests attach the way TQ does: build the class it looks up by name and call setup; the attach test asserts setup got the offload arguments. A new test keeps the no-op attach and expects the guard to raise, so dropping the guard fails a test. - The _init_tq test stubs the eviction watcher: no master runs there. - Functional recovery suite: a mooncake_gdr variant (mooncake_cpu with use_gdr=true) runs SSD offload under memory pressure with GDR clients, checks SSD files were written and that the GDR put path was taken. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…ng the run require_disk_backed() refused every RAM-backed directory. That is right for the default: /tmp as tmpfs would silently turn the SSD tier into a second copy in memory. A path the config names is a choice, for example the 3 GiB tmpfs that test_mooncake_ssd_eviction_stops_the_run mounts as its small disk, so it now runs with a warning that says what it costs. Both tiers pass whether the path was configured. The shared fake store answers batch_is_exist so the sweep thread stays quiet in tests. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
bc12d08 to
2179517
Compare
|
/ok to test 2179517 |
…kind-advantages Brings in 69 commits, including per-environment GRPO settings (grpo.agent_overrides, #5321) and the advantage statistics fix across filtering and batch splitting (#5216). Two conflict blocks, both resolved by keeping both sides: - grpo.py: DEFAULT_POLICY_FAILURE_KINDS next to main's AgentOverrideConfig. - test_rollout_reassembler.py: this PR's infra-failure weight test next to main's agent-name stamping tests. One more change keeps this PR's test working: the sync-trainer case of test_trainers_infra_masked_reward_never_moves_valid_siblings sets data_plane.backend, which grpo_train_sync now reads (#5151 made the same change to main's tests). exclude_infra needs no change for agent_overrides: its voters do not depend on overlong_filtering, so main's dynamic-sampling check stays limited to masked_reward_policy "exclude". Main's ledger schema is still 8, so failure_kind stays in schema 9. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Stack: PR 2 of 3, on top of #5150 (
nixl.ssd.io_threads), which sits on #5145. Review the last 10 commits only (bc583ffba8SSD offload on by default, with a memory-pressure warning,46123e3ca8default SSD tier directories on the node's NVMe,84016d5dd9Mooncake offload metrics every step, one warning per run,d510bda8d1single-controller recovery tests cover the default SSD tiers,52a2d7bc30ray.sub mounts a per-user NVMe dir at /raid; one note when the tiers fall back to /tmp,99283f943dreview follow-ups for the default SSD tiers,a03c296106reference config follows the 0.8 offload_threshold default,8c41d9846cruff format test_local_disk.py,e292d500c4ruff format two data-plane tests,5e1224ecb8review follow-ups for the default SSD tiers (round 2)); the earlier ones are #5150 and #5145.Review follow-ups round 2 (
5e1224ecb8): per-user default folders (<name>-<uid>), nixl resolves a null path in each unit,simple.ssd_offloadgets the null-path default, test mocks setdata_plane.backend,nixl_ssdfunctional sizes back to 128 KiB + 128 KiB, docs and comments per the review.Review follow-ups (
99283f943d, wasded40c039): the nixl IO area is pinned beside the slab, so the default-on tier no longer shrinks the put area (a unit holdsunit_slab_bytes + staging_bytes); Mooncakeoffload_thresholddefault 0.8;ray.sublists the/raidmount beforeMOUNTS;grpo_synclogs the backend counters and the one-time warning through the same helper as the single controller (observability.backend_health_metrics). A/B of the tiers on against off with nothing spilled, and the like-for-like pressure numbers, are in the review thread.What
data_plane.mooncake_cpu.ssd_offloadanddata_plane.nixl.ssdare on by default, with one warning per run at the first spill.simple.ssd_offloadstays off but gets the samepath: nulldefault. The nixl IO area (staging_bytes, a quarter of the slab by default) is pinned beside the slab, so the put area keeps its configured size.Why
Both tiers spill only when memory is full (mooncake: above
offload_threshold; nixl: when a unit's put area is full). While memory suffices nothing is written, so the default costs nothing, and a run whose data plane outgrows memory degrades instead of failing.simple.ssd_offloadis by value size (every value>= threshold_bytesalways goes to SSD), which is a real cost, so it is not defaulted.The warning and the metrics
The user should know when the workload is under memory pressure and paying for it. Both backends warn once per run, from the single controller, at the first spill, and log their SSD tier every step beside the other data-plane metrics:
data_plane/nixl/ssd_spills_sum,ssd_spilled_mb_sum(fromtq_nixl.unit_metrics()); the warning fires whenssd_spills_sumfirst rises above 0./metricsevery step (the URL travels in the TQMooncakeStoreconfig block) and logsdata_plane/mooncake/mem_used_mb,mem_capacity_mb,mem_used_ratio,keys,offload_rounds_total,mem_evicted_keys_total,mem_evicted_mb_total,disk_evictions_total; the warning fires whenoffload_rounds_totalfirst rises above 0. Mooncake 0.3.x has no per-object offload counter: each successful eviction round wrote objects to the owners' SSD (offload_rounds_total), andmem_evicted_*count the memory copies it then dropped, whose reads go through the SSD. Past the threshold with memory to spare it keeps the memory copies (forced-spill test: 112 files, 11 rounds, 0 dropped); under memory pressure it drops them (150 GB recipe: 34,693 dropped). The owners' 30 s sweep is back to only deleting files of cleared keys.Default path: the node's NVMe
path: null(the default) resolves on the node that creates the directory (local_disk.default_ssd_dir):/raid/<name>-<uid>when/raidis in/proc/mounts, is not RAM-backed and is writable by the process, else/tmp/<name>-<uid>(one folder per user: the first run creates it 0755). nixl resolves it in each storage unit, on the unit's own node;simpleon the driver, since TQ creates the folder inside its own actor. An owner still refuses a tmpfs/ramfs result (require_disk_backed). An explicitpathmust be absolute, as before.ray.subputs the NVMe there by itself: it mounts a per-user directory at the container's/raid,NRL_NVME_DIRwhen set (e.g./raid/scratch/$USERon a cluster whose RAID root is root-owned) else/raid/$USER, created on every node where its parent is writable (a bare-metal DGX whose user owns/raid, or a site-provided directory). Never the shared RAID root, so users on one node cannot collide. No writable directory: no mount, and the driver logs one note per run saying the tiers use/tmpand what/tmpis (ext4 mounted at /in an enroot container, where/tmpis the NVMe RAID already).Two facts from the GB300 runs shaped this:
os.path.ismount("/raid")is False inside an enroot container (the container root itself lives under/raid), so the check reads/proc/mounts; and a stock/raidis root-owned, so an unwritable/raidfalls back to/tmpinstead of failing.path: null(folder names from before the-<uid>suffix)/raidroot-owned, nixl and mooncake/raid/nrl_*, owners died withPermissionError(before the writability rule)/raidwritable, nixl/raidwritable, mooncake/raid/nrl_mooncake_ssd_offload, 1,027 to 2,447 objects offloaded per owner, 17,416 files / 190 MB on the host NVMe mid-run, directories removed at exit/raid, nixl/tmp/nrl_nixl_ssd; one note from the driverNRL_NVME_DIR=/raid/scratch/$USER, nixl forced spillray.subcreated the directory on both nodes and mounted it at/raid; exit 0, 67 blobs spilled, no noteAlso
require_offloading_store()runs only formooncake_cpu: the guard is mooncake's, andinstall()keeps per-process state.ssd_offload.enabled: false(there is no store to swap); the shared mooncake session client too, since that test process also holds the simple client and TQ builds one store per process.test_mooncake_ssd_offload_e2e.pycovers offload itself.Functional tests (
tests/functional/grpo_dp_single_controller_tq_recovery.sh)mooncake_units,nixlpath: null)offload_rounds_total == 0/ssd_spills_sum == 0; mooncake owners log the default NVMe directorymooncake_cpu,nixl_ssdenabled=truedropped, now the default)offload_rounds_total > 0,disk_evictions_total == 0(mooncake); spills > 0 (nixl, as before)All four pass on GB300 (one node, Qwen3-0.6B).
Verification
Unit,
nightly-gym.2026-11-05image:test_backend_config,test_factory,test_mooncake_ssd_offload,nixl/test_ssd_tier,test_tq_lifecycle,test_local_disk,test_tq_nixl_ssd,test_tq_mooncake_checkpoint: 298 passed plustest_config_v2: 52 passed (2 failures intest_ssd_tierare the open-file-count race that #5150's last commit fixes).Real single-controller recipe on GB300, 2 nodes, 3 steps, no launcher data-plane settings beyond the backend:
unit_slab_bytes64 MiBoffload_threshold0.02mem_evicted_keys_total16,140 / 25,303 / 34,693 andmem_evicted_mb_total111 / 171 / 232 at steps 1-3;mem_used_ratio0.017-0.019 against threshold 0.02Known, not changed here (follow-up): under heavy offload, a mooncake owner serving reads of offloaded objects can exhaust its 1.25 GB read arena (
MOONCAKE_OFFLOAD_LOCAL_BUFFER_SIZE_BYTES, 5 s leases) and returnBUFFER_OVERFLOW; TQ retries 3 x 1 s then raises. Seen in a 150 GB/node synthetic run atoffload_threshold 0.5.🤖 Generated with Claude Code