Skip to content

feat(mooncake): read server captures over multi-node NVLink - #939

Merged
jiapingW merged 5 commits into
maocheng/nvlink-capture-sinkfrom
maocheng/nvlink-capture-client
Oct 18, 2026
Merged

jiapingW merged 5 commits into
maocheng/nvlink-capture-sinkfrom
maocheng/nvlink-capture-client

Conversation

@maocheng23

@maocheng23 maocheng23 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Multi-node NVLink capture transport, part 2 of 2 (trainer side). Stacked on #938.

Changes

  • ArenaObjectClient (new, runtime/data_plane/mooncake_arena.py) implements the Mooncake store calls that MooncakeFeatureStore makes, reading from capture-server arenas. Currently only online NVLink capture uses the arena:
    • get_into reads straight from the server GPU with TransferEngine.transfer_sync_read.
    • remove writes the key to a persistent TCP connection to the sink and returns; the sink applies it before its next allocation, so the durable ack never waits on the capture server. A failed write returns an error, so the feature store retries it as a pending removal. A key that no ref has located (a lost capture response) is freed on every server the client has seen.
  • MooncakeFeatureStore passes each ref's object addresses to the backend in adopt and get (locate_ref_objects). Everything else is unchanged: generations, leases, release-pending retries and lifecycle drains work as they do with the store.
  • The server-capture adapter copies the sink's addresses into SampleRef.metadata["mooncake_arena"].
  • Config:
    • managed_local.mooncake.protocol accepts nvlink.
    • New managed_local.mooncake.arena_bytes (required with nvlink, rejected otherwise): the HBM each capture server reserves for its arena. The launch plan renders it as SGLANG_SPEC_CAPTURE_ARENA_BYTES on every capture server.
    • Objects stay on the servers until the optimizer-boundary ack, so runtime.resident_high_watermark_bytes must be set with nvlink. For managed-local stacks it must also fit in servers × arena_bytes, so the producer stops capturing before an arena fills.
    • nvlink requires receive_buffers: cuda, and capture_servers[].gpu_put: false is rejected. On the trainer only the existing receive_pool_bytes applies.
    • One validate_receive_buffers now serves the schema, the launch plan and the store factory.
  • Launch plan: sets MC_FORCE_MNNVL=1 for capture servers and roles, because Mooncake otherwise prefers the RDMA NICs. External NVLink deployments no longer require Mooncake store endpoints.

Notes

  • Server HBM: objects stay on the server until the optimizer-boundary acknowledgement frees them, the same lifetime store objects have now. The arena comes out of SGLang's headroom, so leave room for arena_bytes below --mem-fraction-static. If it doesn't fit, the first capture fails and the error says so.
  • Default-stream wait (measured on GB300): each read first waits for work already queued on the trainer's default CUDA stream, because Mooncake syncs cudaStreamPerThread before every copy. Loader prefetch hides this; work on a side stream does not cause the wait.

Tests

  • CPU:
    • The real adapter → MooncakeFeatureStore → ArenaObjectClient stack against a stub server and a fake engine: reads, consume-once frees, frees of lost responses, failed sends staying pending until retried.
    • The store factory.
    • Launch-plan env and validation for managed-local and external NVLink: arena size required and rendered, watermark required and bounded.
  • GB300, across two trays (c001 → c004), real TransferEngine with the part 1 sink: 64 capture-shaped samples (6.47 GiB) read back byte-exact into CUDA receive buffers, 3.5 ms per ~100 MB sample on average (31 GB/s including receive-pool copies), all freed.
  • GB300 end to end (Qwen3.8-27B DFlash2, four TP1 capture servers on one tray, four trainer ranks on another): 16 optimizer steps complete.
    • Losses match TCP. Step 1 is identical in every run (25.3694), and steps 2–4 agree within 0.007. Later steps vary with sample order in any two runs, including between the two TCP runs.

    • Compute per step is the same for both transports. The difference is overhead, summed over steps 3–16:

      fetch per sample (median) data wait training blocked on acks samples/s
      NVLink 0.84 ms 0.016 s 0.000 s 22.7
      TCP store, 2 runs 5.3–5.6 ms 0.08–0.09 s 0.20–0.71 s 18.6–21.4
    • At this scale training compute dominates, so the end-to-end gain is modest. The 6× faster fetch matters more as capture throughput grows.

🤖 Generated with Claude Code

maocheng23 and others added 4 commits October 6, 2026 14:59
MOONCAKE_PROTOCOL=nvlink (managed_local.mooncake.protocol or
deployment.disaggregated.mooncake_protocol) reads capture objects straight
from the server GPU into receive_buffers=cuda. NvlinkObjectClient implements
the Mooncake store calls MooncakeFeatureStore makes, so generations, leases
and removal retries are unchanged; objects are located from the addresses
the sink returns on each SampleRef and freed through its control endpoint.
The launch plan sets MC_FORCE_MNNVL so Mooncake picks NVLink over the RDMA
NICs, and external NVLink deployments need no Mooncake store endpoints.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first version freed each object with an HTTP request that a Python
thread inside the busy SGLang scheduler process served. GIL handoffs made
each request take tens of milliseconds, so on GB300 the durable ack took
0.16-0.29 s per step and blocked the training thread. remove() now writes
the key to a persistent TCP connection and returns; the sink applies frees
before it allocates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
managed_local.mooncake.nvlink_arena_bytes sets the HBM each capture server
reserves for NVLink capture objects (SGLANG_SPEC_CAPTURE_NVLINK_ARENA_BYTES)
and is required with protocol nvlink. Because those objects stay on the
servers until the optimizer-boundary ack, runtime.resident_high_watermark_bytes
must be set and, for managed-local stacks, fit in the servers' summed arenas;
the producer then stops capturing before an arena fills. The trainer side
keeps its existing receive_pool_bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
NvlinkObjectClient becomes ArenaObjectClient (runtime/data_plane/
mooncake_arena.py), the ref metadata key becomes "mooncake_arena", the sink's
result field becomes "arena" and nvlink_arena_bytes becomes arena_bytes
(SGLANG_SPEC_CAPTURE_ARENA_BYTES). Where a sample waits is independent of how
its bytes move; currently only online NVLink capture uses the arena, which
is noted at each place that decides it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jiapingW
jiapingW self-requested a review October 18, 2026 08:30
@jiapingW
jiapingW merged commit 32f5402 into maocheng/nvlink-capture-sink Oct 18, 2026
1 check passed
@jiapingW
jiapingW deleted the maocheng/nvlink-capture-client branch October 18, 2026 08:31
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.

2 participants