Skip to content

[Store] Enable NUMA-segmented allocation for RDMA RealClient-only mode#1838

Merged
ykwd merged 1 commit intokvcache-ai:mainfrom
00fish0:fix/numa-partition-segment
Apr 15, 2026
Merged

[Store] Enable NUMA-segmented allocation for RDMA RealClient-only mode#1838
ykwd merged 1 commit intokvcache-ai:mainfrom
00fish0:fix/numa-partition-segment

Conversation

@00fish0
Copy link
Copy Markdown
Collaborator

@00fish0 00fish0 commented Apr 7, 2026

Description

Previously, NUMA-aware global segment allocation (#1580) was gated behind !ipc_socket_path_.empty(), meaning it only activated in Dummy+Real Client mode. In practice, the vast majority of deployments (mooncake_store_service, sglang/vLLM integration, Python store.setup()) use RealClient-only mode.

Remove the ipc_socket_path condition so that all RDMA deployments benefit from NUMA-segmented memory allocation and NUMA-aware NIC routing via selectDevice.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • PyTorch Backend (mooncake-pg)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Other

How Has This Been Tested?

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using ./scripts/code_format.sh before submitting.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

Previously, NUMA-aware global segment allocation was gated behind
`!ipc_socket_path_.empty()`, meaning it only activated in standalone
(Dummy+Real Client) mode. In practice, the vast majority of
deployments (mooncake_store_service, sglang/vLLM integration, Python
store.setup()) use RealClient-only mode where ipc_socket_path is
always empty, so NUMA optimization never triggered.

Remove the ipc_socket_path condition so that all RDMA deployments
benefit from NUMA-segmented memory allocation and NUMA-aware NIC
routing via selectDevice.
Copilot AI review requested due to automatic review settings April 7, 2026 12:37
@00fish0 00fish0 changed the title [Store] Enable NUMA-segmented allocation for all RDMA deployments [Store] Enable NUMA-segmented allocation for RDMA RealClient-only mode Apr 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the setup_internal method in mooncake-store/src/real_client.cpp to ensure that NUMA node discovery and distribution for RDMA protocols occur regardless of whether the IPC socket path is set. This change expands the application of NIC-based NUMA optimization beyond standalone mode. I have no feedback to provide as no review comments were present.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables NUMA-segmented global segment allocation for all RDMA deployments in Mooncake Store by removing the previous standalone-mode (ipc_socket_path_ non-empty) gating, allowing more deployments to benefit from NUMA-aware NIC routing.

Changes:

  • Remove the !ipc_socket_path_.empty() condition so NUMA-segmented allocation can activate whenever protocol == "rdma".
  • Update the in-code comment to reflect the broader applicability (not standalone-only).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +468 to 472
// For RDMA, auto-discover NUMA nodes with NICs and distribute
// global_segment across them for full NIC utilization.
std::vector<int> seg_numa_nodes;
if (!ipc_socket_path_.empty() && protocol == "rdma") {
if (protocol == "rdma") {
seg_numa_nodes = client_->GetNicNumaNodes();
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

Removing the ipc_socket_path_ gate makes NUMA-segmented allocation take effect in more RDMA deployments. In that mode, page_sz is derived from get_hugepage_size_from_env() when should_use_hugepage is true, but allocate_buffer_numa_segments() currently uses a plain anonymous mmap (no hugepage flags), so enabling segmented mode can effectively bypass hugepage-backed allocation for multi-NUMA NIC hosts. Consider either (a) explicitly documenting that segmented allocation takes precedence over hugepages, or (b) extending allocate_buffer_numa_segments() to support hugepage mappings when should_use_hugepage is enabled.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@ykwd ykwd left a comment

Choose a reason for hiding this comment

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

LGTM

@ykwd ykwd merged commit c44a052 into kvcache-ai:main Apr 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants