mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #1062] [RFC]: Add Local Cache Mechanism for Mooncake Store Client #351
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#351
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 @Shichang-Zhang on GitHub (Nov 15, 2025).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/1062
Originally assigned to: @Shichang-Zhang on GitHub.
Changes proposed
Introduction
Hello Mooncake community,
We are from the openFuyao community and are actively working on cloud-native LLM inference acceleration. We would like to share our initial proposal, which introduces a hot data caching mechanism based on the LRU (Least Recently Used) eviction strategy for Mooncake Store. This optimization aims to improve memory utilization, reduce cross-node network access overhead, enhance local availability of hot data, and thereby improve the performance of single-key and batch get operations in distributed KV Cache storage.
Motivation
The Master Service randomly assigns the data slices to storage nodes in the cluster. This architectural design results in frequent cross-node network transmission to get each slice when accessing specific KV Cache data. Furthermore, research from the Mooncake paper indicates that over 50% of data is accessed only once, while some hot data can be accessed tens of thousands of times.
This provides clear directions for the optimization:
This proposal introduces a client-side caching mechanism based on the LRU eviction strategy, which accelerates KV Cache reads by caching hot data, thereby improving TTFT.
Goals
Non-Goals
Proposal
Architecture
This section provides an overall architectural view of the Mooncake Store acceleration solution.
Logical Architecture View
This proposal enhances Mooncake's storage strategy:
Logical Architecture Description:
Implementation
Feature Overview
The current Mooncake get/batchGet request processing flow is: query metadata → submit transfer task → wait for transfer completion → return data directly.
The optimization introduces a hot data caching mechanism on the Client side:
Sequence Diagram
local_hot_cache_size_(default value 0, standing for disabled)LOCAL_MEMCPYtransport strategy for optimizationData Structures
New
Clientclass members:hot_cache_: Hot cache manager instancehot_cache_handler_: Hot cache asynchronous task handler instanceLocalHotCacheclass: Hot cache management class for cache lifecycle management, it involves:total_size_bytes_: Hot cache size limit (in bytes)blocks_: Hot cache memory block list, store actual cached sliceslru_queue_: Doubly linked list, maintain LRU eviction strategykey_to_lru_it_: Cache key-value mapping table, where key is{request_key}_{slice_index}and value is LRU list node iteratorlru_mutex_: Mutex for concurrent access protectionHotMemBlockstruct: Hot cache data block structureaddress_: Memory address pointersize_: Data block size (in bytes)LocalHotCacheHandlerclass: Hot cache asynchronous task handlerBefore submitting a new issue...
@stmatengss commented on GitHub (Nov 17, 2025):
Good idea. LGTM. Looking forward to your PR! Local caching can improve performance, and we should consider making this feature optional for the generic client.
@stmatengss commented on GitHub (Nov 17, 2025):
Another ideal, it seems we should support two kinds of clients. One is a standalone client without master. The other is distributed deployment with many clients and a master.
@Keithwwa commented on GitHub (Nov 18, 2025):
Great idea! I have a few more questions:
local_hot_cache_size_value seems to strongly depend on personal experience and application scenarios. Is this configuration value necessary?@Shichang-Zhang commented on GitHub (Nov 18, 2025):
Thanks for you r comments!
local_hot_cache_size_is strongly depends on the inference scenario. We expect to achieve an optimal balance, where the benefit from reduced cross-node data transfer outweighs the extra local cache memory cost.local_hot_cache_size_is configurable, user can simply disable by setting it to 0. Currently we are conducting tests across several scenarios, and we will detail the configuration recommendations with test scenarios in the PR.@Shichang-Zhang commented on GitHub (Nov 18, 2025):
Appreciate the affirmation! I’ve completed parts of implementation and performance verification. The PR will be raised in the next few days, and I’ll link it to this issue once submitted.
@Mag-FelixFelicis commented on GitHub (Nov 19, 2025):
Interesting idea!
@NUABO commented on GitHub (Dec 2, 2025):
What good news!
@github-actions[bot] commented on GitHub (Jun 19, 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 (Jun 26, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.