Skip to content

[Perf]: Reuse Mooncake buffer pool for RDMA puts - #216

Open
chenjr97 wants to merge 1 commit into
Ascend:mainfrom
chenjr97:chenjr/put_buffer
Open

chenjr97 wants to merge 1 commit into
Ascend:mainfrom
chenjr97:chenjr/put_buffer

Conversation

@chenjr97

@chenjr97 chenjr97 commented Nov 11, 2026 •

Copy link
Copy Markdown

overview

Extend the pre-registered buffer pool approach from #175, which optimized GET, to CPU RDMA PUT.

Implementation

  • Reuse the existing Mooncake BufferPool, backed by the local buffer registered during store setup.
  • Lease a buffer, copy payloads into it, and release it after synchronous batch upsert and any retries complete.
  • Copy uniform, contiguous tensor groups in one strided operation and ragged groups per tensor. Route serialized non-tensor values through the same PUT worker.
  • Fall back to direct registration when the pool is missing or unavailable, a group exceeds the per-worker limit, or a batch contains duplicate keys.

Evaluation

Setup

Benchmarks ran on a single node with the PUT client and storage segment colocated, using RDMA with either 1 or 8 HCAs. Each HCA port reported an active Ethernet link rate of 200 Gb/s.

Setting Value
Mooncake 0.3.12.post1
Payload Dense CPU uint8 tensors
Local buffer / storage segment 10 GiB / 16 GiB
Batch size limit / maximum batch workers 400 / 4
Samples per variant, case, and HCA configuration 5 warmups + 10 measured runs

Latency measures await client.async_put(metadata=None), including metadata, storage, and controller work. Payload preparation, initialization, subsequent GET verification, and partition clearing run outside the timed region. The figure below presents the complete benchmark results.

PUT latency

The table below includes the single-key, 1 GiB total, and largest tested cases for each payload size, with duplicates removed. Speedup is baseline median latency divided by pooled median latency.

Package size / key Keys / PUT Total / PUT 1 HCA speedup 1 HCA reg + unreg saved (ms) 8 HCA speedup 8 HCA reg + unreg saved (ms)
4 MiB 256 1 GiB 1.40× 36.98 2.20× 91.13
16 MiB 64 1 GiB 1.53× 40.57 2.09× 74.87
16 MiB 256 4 GiB 1.36× 162.34 3.22× 475.54
64 MiB 16 1 GiB 1.66× 44.66 3.50× 93.62
64 MiB 64 4 GiB 1.47× 177.99 2.75× 509.66
64 MiB 128 8 GiB 1.55× 386.22 3.20× 1011.39
256 MiB 4 1 GiB 1.95× 84.01 3.26× 102.36
256 MiB 16 4 GiB 1.47× 196.08 3.29× 506.37
256 MiB 32 8 GiB 1.65× 412.80 3.27× 998.25
1024 MiB 1 1 GiB 1.45× 71.00 3.02× 155.74
1024 MiB 4 4 GiB 1.45× 198.54 3.08× 491.34
1024 MiB 8 8 GiB 1.46× 404.62 2.97× 948.90
put_buffer_latency

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 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-11T16:45:24.878143Z 7a5245b PR opened
ℹ️ 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.

@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: 7a5245b2dd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


batch_ptrs, batch_sizes, _ = self._preprocess_tensors_for_put(batch_tensors)
batch_ptrs, batch_sizes, batch_tensors = self._preprocess_tensors_for_put(batch_tensors)
if self._buffer_pool is not None and len(set(batch_keys)) == len(batch_keys):

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 NPU tensors on the direct registration path

When protocol="rdma" is used with an Ascend/NPU TensorDict, _preprocess_tensors_for_put preserves NPU tensors (it only calls .cpu() for CUDA), yet this unconditional pool branch sends them to _copy_between_buffer_and_tensors, whose torch.frombuffer destination is CPU memory. The previous path registered each NPU data_ptr() directly (and _bind_npu_device exists to make those registrations work); now every pool-sized NPU value pays a synchronous device-to-host copy and loses the direct-device transfer path, while only oversized or pool-exhausted groups retain the old behavior. Restrict pooling to CPU-backed tensors so NPU puts keep the registered-pointer path.

Useful? React with 👍 / 👎.

@chenjr97 chenjr97 changed the title [perf]:Reuse Mooncake buffer pool for RDMA puts [perf]: Reuse pre-registered buffers for Mooncake RDMA puts Nov 11, 2026
@chenjr97 chenjr97 changed the title [perf]: Reuse pre-registered buffers for Mooncake RDMA puts [perf]: Reuse Mooncake buffer pool for RDMA puts Nov 11, 2026
@chenjr97 chenjr97 changed the title [perf]: Reuse Mooncake buffer pool for RDMA puts [Perf]: Reuse Mooncake buffer pool for RDMA puts Nov 11, 2026
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