TL;DR
DualMap solves the fundamental "tug-of-war" between cache affinity and load balancing in distributed LLM serving. By mapping requests to two candidate nodes instead of just one—leveraging the "power of two choices" principle—it achieves high cache hit rates while maintaining a perfectly balanced cluster, boosting serving capacity by up to 2.25×.
What Problem Does This Paper Address?
In the world of Large Language Model (LLM) serving, efficiency is everything. One of the best ways to speed up response times (specifically the Time-To-First-Token or TTFT) is prefix caching. Since many requests share the same instructions or conversation history, servers can store the intermediate "KV cache" and reuse it instead of recomputing it every time.
However, this creates a scheduling conflict:
- Cache Affinity: To maximize reuse, you want all requests with the same prompt prefix to go to the same specific server.
- Load Balancing: To prevent any single server from becoming a bottleneck, you want to spread requests evenly across the cluster.
If a specific prompt becomes "viral" (a hotspot), a cache-affinity scheduler will crush one server while others sit idle. Conversely, a load balancer will scatter requests across the cluster, destroying the benefits of the cache. Current state-of-the-art schedulers (like Mooncake or Preble) try to find a middle ground but usually end up sacrificing one goal for the other.
Methods
The authors introduce DualMap, which breaks this trade-off using a "dual-mapping" strategy inspired by the mathematical "power of two choices" (PoTC) principle.
- Dual-Hash Mapping: Instead of mapping a request to one server, DualMap uses two independent hash functions ($f_1$ and $f_2$) based on the prompt prefix to identify two candidate servers. This ensures that requests with the same prefix are always sent to the same pair of nodes, preserving cache locality while providing a "backup" option for load balancing.
- SLO-Aware Routing: The scheduler doesn't just pick the least-loaded node. It prioritizes the node with the existing cache unless that node's queue is so long that it would violate the Service Level Objective (SLO)—the promised response time. Only then does it switch to the second, less-loaded candidate.
- Hotspot-Aware Rebalancing: If a specific prompt prefix is so popular that both candidate nodes are overwhelmed, DualMap can proactively migrate queued requests to their alternative candidate nodes to relieve the "hotspot" without scattering the prefix across the entire cluster.
- Lightweight Dual-Hash-Ring Scaling: To handle adding or removing GPUs from a cluster, DualMap uses a consistent hashing ring. Because it uses a dual-ring approach, scaling operations only affect a tiny fraction of existing mappings, preventing a "cache storm" where every server has to recompute everything after a cluster resize.
Datasets
The researchers evaluated DualMap using two real-world trace datasets originally introduced in the Mooncake project:
- Conversation: Derived from multi-turn chatbot interactions, featuring high intra-session prefix reuse (~40% cache ratio).
- Tool&Agent: Characterized by long, repetitive system prompts used in AI agent workflows (~59% cache ratio).
The experiments were conducted on clusters of 8 to 32 instances using Qwen2.5-7B and 14B models.
Key Insights and Ideas
- Two is the Magic Number: The "Power of Two Choices" is a classic computer science result showing that choosing the better of just two random options is exponentially better for balance than choosing one, and nearly as good as checking every single node in the cluster. DualMap applies this to the prefix space rather than just the request space.
- Deterministic but Flexible: By hashing to a pair, the system is deterministic (good for cache) but flexible (good for load). It limits the "search space" for a cache to just two nodes, which is much more efficient than a global search.
- Adaptive Prefix Length: The system doesn't just hash the whole prompt. It uses a "hotness tree" to dynamically decide how much of a prompt to use as a hash key. If a prefix is "cold," it uses a shorter key to aggregate requests; if it's "hot," it uses a longer key to spread them out.
Key Results
- Capacity Boost: DualMap improved "effective request capacity" (the number of requests served while staying under the 5-second TTFT limit) by up to 2.25× compared to previous state-of-the-art methods.
- Tail Latency Reduction: In high-traffic scenarios, DualMap reduced P90 TTFT (the latency experienced by the unluckiest 10% of users) by 82.3% to 97%.
- Best of Both Worlds: In ablation studies, DualMap maintained a cache hit rate nearly as high as pure "Cache Affinity" strategies while keeping a "Load Balance Ratio" (Coefficient of Variation) nearly as low as "Least Loaded" strategies.
Limitations and Future Work
- Memory Contention: The paper notes that when GPU memory is completely exhausted, the system hits a "decode bottleneck." While DualMap's rebalancing helps, extreme memory pressure remains a challenge for all LLM serving systems.
- Scheduler Metadata: The global scheduler must track the cache state of every node. While the authors show this metadata is small (a few megabytes for 32 nodes), very large-scale deployments (thousands of nodes) might require a more hierarchical or distributed scheduler design.
- Inter-Node Transfer: The current version focuses on local cache reuse. Future work could explore integrating DualMap with peer-to-peer KV cache transfer between the two candidate nodes.
Summary updated