mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #690] [MERGED] [Store]feat: Migrate Persistence Metadata from Client to Master Service #1747
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#1747
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?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/Mooncake/pull/690
Author: @SgtPepperr
Created: 7/29/2025
Status: ✅ Merged
Merged: 8/14/2025
Merged by: @stmatengss
Base:
main← Head:ssd_master📝 Commits (10+)
30c50d6initial commitc18d2befix client::query return fault09176c3fix isexist return faultc5fef16fix test bugdba12affix clearinvalidhandles problem3f4d614add file description for 3fsd0f3929change ssd function start from client to master5bea6e9fix conflict1a91f2dfix naming error40d2a5cedit doc description📊 Changes
34 files changed (+875 additions, -492 deletions)
View changed files
📝
doc/en/mooncake-store-preview.md(+12 -8)📝
doc/zh/mooncake-store-preview.md(+11 -6)📝
docs/source/design/mooncake-store-preview.md(+12 -8)📝
mooncake-store/include/client.h(+3 -5)📝
mooncake-store/include/config.h(+1 -0)📝
mooncake-store/include/ha_helper.h(+2 -0)📝
mooncake-store/include/master_client.h(+5 -2)📝
mooncake-store/include/master_service.h(+58 -6)📝
mooncake-store/include/rpc_service.h(+5 -2)📝
mooncake-store/include/storage_backend.h(+14 -44)📝
mooncake-store/include/transfer_task.h(+2 -2)📝
mooncake-store/include/types.h(+124 -32)📝
mooncake-store/src/client.cpp(+104 -102)📝
mooncake-store/src/client_buffer.cpp(+2 -2)📝
mooncake-store/src/ha_helper.cpp(+3 -2)📝
mooncake-store/src/hf3fs/README.md(+3 -2)📝
mooncake-store/src/hf3fs/hf3fs_file.cpp(+2 -24)📝
mooncake-store/src/master.cpp(+12 -1)📝
mooncake-store/src/master_client.cpp(+8 -4)📝
mooncake-store/src/master_service.cpp(+125 -43)...and 14 more files
📄 Description
Background
Based on the iteration roadmap discussed in previous PRs #610 and issues #578 , this release migrates the metadata management of the SSD KV-cache in the hierarchical caching feature from the client to the master service, preserving the control-data separation design philosophy of Mooncake.
The main benefits are:
BatchGetread performance on 3FS.Design & Implementation
The key idea is to extend the notion of replica so it can be either memory or disk.
PutStartnow returns both memory replica and a disk replica.The client writes data to each independently.
Disk-replica file writes are asynchronous (handled by a dedicated file-writer thread pool) and therefore do not block the synchronous path.
PutEndRPC is extended:– The synchronous path issues
PutEndfor the memory replica.– The asynchronous path issues
PutEndfor the disk replica.Getchooses the appropriate read path depending on replica type.Evictis modified: instead of deleting the entire metadata entry, only the memory replica portion is removed.The persistence switch is still controlled by the client:
– If a storage path is specified → enable disk replica (
Put/Get).– If not specified → skip all disk-related operations.
The persistence feature's switch has been moved from the client to the master side, where enabling persistence is now controlled by specifying (--root_fs_dir=/path/to/dir)during master startup, requiring all client hosts to mount their DFS directories under this specified path to avoid potential abnormal behavior in Mooncake Store.
State Transitions
Moving metadata from the client to the master increases the complexity of state management:
memoryonlymem,mem+disk,diskFurther, each replica has its own status (e.g.,
PROCESSING,COMPLETED), so the combined state space explodes.Explicit tests and eventually state-machine diagrams will be added to prevent bugs.
Basic transition rules
Corner Cases
Mixed persistence settings
3 clients, 2 with valid mount directory, 1 with invalid mount directory.
– potential abnormal behavior may happen in Mooncake Store.
Memory write fails, disk write succeeds (mem+disk path)
– Memory failure triggers
PutRevoke, removing the memory replica.– Disk success triggers
PutEnd, leaving aCOMPLETEDdisk replica usable by later reads.New
Puton an existing pure-disk replica– Currently rejected with “object exists”.
– Future plan: allow re-adding a memory replica, transitioning
disk→mem+disk.Get while disk replica is still processing
– If the memory replica exist and are
COMPLETED, the master returns all completed replicas, ignoring the still-processing disk replica.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.