mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #1749] [RFC]: Optimizing Mooncake TCP Transport for High-Concurrency Throughput #507
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#507
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 @yxj-97 on GitHub (Mar 26, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/1749
Originally assigned to: @alogfans, @maheshrbapatu on GitHub.
Changes proposed
1. Summary
This RFC proposes optimizations to Mooncake TCP Transport by introducing multiple io_contexts for parallel processing, a concurrency limiter, asynchronous connection establishment, and CUDA asynchronous copy, in order to improve throughput and GPU memory transfer efficiency under high-concurrency workloads.
2. Motivation
2.1 Current Architecture Analysis
The existing TCP Transport uses a single io_context and worker thread model:
2.2 Performance Bottlenecks
2.3 Current Performance
In an environment measured by iperf3 with 10.8 GB/s bandwidth, the current performance is as follows:
2.4 Design Goals
3. Proposed Design
3.1 Architecture Overview
3.2 Multi-IO Context Pool
3.2.1 Design Principles
In the current single io_context model, all socket events (accept, read, write) are handled by the same thread through io_context.run(). On multicore systems, this leads to:
The proposed improvement is:
Configure the number of I/O threads via the MC_NUM_TCP_IO_THREADS environment variable
3.2.2 Acceptor Load Balancing
Use SO_REUSEPORT to allow multiple sockets to bind to the same port, so the kernel can automatically distribute incoming connections across different acceptors:
3.3 ConcurrencyLimiter
3.3.1 Design Principles
Unrestricted concurrency may cause:
A soft flow-control mechanism is introduced through ConcurrencyLimiter:
3.3.2 Key Interfaces
immediately; otherwise enqueue it
3.4 Async Connection Pool
3.4.1 Differences from the Current Implementation
3.4.2 Retry Strategy
Exponential backoff with random jitter.
3.4.3 GC Mechanism
The connection pool maintains a periodic timer to scan and clean up:
3.5 CUDA Async Copy Subsystem
3.5.1 Current Problems
In the existing implementation, Session::writeBody / readBody have the following issues:
3.5.2 Proposed Solution
Pinned memory reuse:
Asynchronous copy + event polling:
4. Configuration
4.1 New Configuration Items
s)
5. Compatibility
5.1 API Compatibility
Public APIs remain unchanged.
5.2 Behavioral Differences
6. Performance
Benchmarking was performed using transfer_engine_bench.
6.1 Test Environment
6.2 Test Results
6.2.1 Single-node Test
6.2.2 Cross-node Test
7. Rollout Plan
Before submitting a new issue...
@maheshrbapatu commented on GitHub (Mar 26, 2026):
@yxj-97
This looks like a strong direction, especially removing the CPU-side bottlenecks around single io_context and synchronous connection setup, and adding flow control via the concurrency limiter .
I don’t currently have access to a GPU setup, but I’d be happy to help on the CPU/networking side e.g., async connection pool behavior, concurrency limiter correctness/tuning, or multi-io_context handling under load. Let me know if there’s an area that would benefit from additional bandwidth.
@yxj-97 commented on GitHub (Mar 30, 2026):
Thanks, really appreciate the offer. I’ve basically finished implementing the RFC and will open a PR soon. I’d be very grateful if you could review it, especially around async connection pooling, concurrency limiter behavior/tuning, and multi-io_context handling under load. Looking forward to your feedback to help improve stability.
@maheshrbapatu commented on GitHub (Mar 30, 2026):
Sure @yxj-97 , will be happy to review it.
@Shl1015CS commented on GitHub (May 17, 2026):
I saw this RFC from the CCF open-source competition topic 3 discussion and I'm interested in contributing to #1749. I'd like to start with the TCP transport opt work.
Is this still open for contribution? If so, I'd be happy to join
Thanks~
@github-actions[bot] commented on GitHub (Aug 16, 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 (Aug 23, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.