mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #1407] [RFC]: ERDMA Support with HugeTLB Memory Allocation #451
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lichang98 on GitHub (Jan 20, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/1407
Changes proposed
Changes Proposed
Summary
Add support for Alibaba Cloud Elastic RDMA (ERDMA) by implementing HugeTLB-based memory allocation and pre-registered buffer management. This enables large-scale memory registration (100s of GBs to TBs) required for LLM inference deployments on ERDMA.
Motivation
Alibaba Cloud Elastic Compute Service (ECS) provides Elastic RDMA (ERDMA) as a high-performance network solution for cloud-native workloads. ERDMA offers RDMA capabilities in virtualized environments but has specific hardware constraints that differ from traditional InfiniBand/RoCE deployments.
Problem Statement
max_mr_sizemax_ep_per_ctxmax_sgeWhy HugeTLB is Required
With standard 4KB pages, ERDMA can register no more than 128GB of memory—insufficient for large-scale LLM inference deployments with large KV cache pools.
Using huge pages (2MB or 1GB) significantly reduces the number of Memory Regions (MRs) needed:
Reference: Alibaba Cloud ERDMA Best Practices
Proposed Changes
1. New Configuration Options
MC_USE_HUGETLBuse_hugetlbfalseMAP_HUGETLBfor memory allocationsMC_CLIENT_BUFFER_SIZEclient_buffer_size2GBMC_MAX_MR_SIZEmax_mr_size0x10000000000(1TB)2. Memory Allocation Strategy
Current Behavior:
aligned_alloc()for segment allocationProposed Behavior (when
MC_USE_HUGETLB=1):mmap()withMAP_HUGETLBflagmmap()if huge pages are unavailableAllocation Flow:
3. Batch Operation Buffer Management
Since inference framework KV buffers are not created with
MAP_HUGETLB, data must be staged through pre-registered buffers although it may bring extra overhead:batch_put_fromflow:batch_get_intoflow:4. Files Modified
mooncake-transfer-engine/include/config.huse_hugetlb,client_buffer_sizefieldsmooncake-transfer-engine/src/config.cppmooncake-store/include/real_client.hclient_mmap_buf_,client_mmap_buf_size_,SegmentAllocstructmooncake-store/src/real_client.cppmooncake-store/src/utils.cppallocate_buffer_allocator_memory()mooncake-store/src/dummy_client.cppUsage Example
Compatibility
MC_USE_HUGETLB=0)mmap()if huge pages unavailableDesign Considerations
MC_CLIENT_BUFFER_SIZETesting Plan
Documentation Updates
References
Before submitting a new issue...
@ykwd commented on GitHub (Jan 20, 2026):
Thanks, this proposal is very useful. Looking forward to the PR.
One request: please make sure it also works correctly in environments without ERDMA or without huge pages.
@stmatengss commented on GitHub (Jan 20, 2026):
FYI: https://github.com/kvcache-ai/Mooncake/pull/1300 I think this proposal can improve the overall performance.
@lichang98 commented on GitHub (Jan 21, 2026):
Thank you for the information. The main part covers what I need, however ERDMA's restrictions don't seem to be taken into account. I'll add a comment below it.
@YiXR commented on GitHub (Jan 22, 2026):
Right now, inference framework like SGLang will use MooncakeHostMemAllocator to create L2 cache no matter if dummy client mode is chosen or not. If MC_USE_HUGEPAGE is set, the inference framework's buffer is created with MAP_HUGETLB.
@YiXR commented on GitHub (Jan 22, 2026):
max_mr_size will be updated by device_attr automatically.
@easonyang1010 commented on GitHub (Mar 27, 2026):
hi, I also encountered this problem, I notice a PR for mooncake-store has been merged. So for mooncake-transfer-engine, this is also work?
@lichang98 commented on GitHub (Apr 18, 2026):
Sorry for the late reply. Have you solved the problem?
@stmatengss commented on GitHub (Apr 18, 2026):
For the transfer engine, users must register memory themselves, allocating it via Hugepage mmap.
@easonyang1010 commented on GitHub (Apr 20, 2026):
@lichang98 yes, I already solved this. It was proved that the OFED version was too low, resulting in the GDR not using a 64KB-sized page. In eRDMA GDR, page size is 64KB, and has nothing to do with hugepage.
@github-actions[bot] commented on GitHub (Jul 20, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
@github-actions[bot] commented on GitHub (Jul 27, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.