mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #1343] [MERGED] [Store]: Use SharedMutex in MetadataShard for better performance #2175
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#2175
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/1343
Author: @nickyc975
Created: 1/8/2026
Status: ✅ Merged
Merged: 1/12/2026
Merged by: @stmatengss
Base:
main← Head:jinlong/metadata-shard-opt📝 Commits (6)
a6b0ed3[Store]: Use 'const std::string&' as param for MasterService::GetReplicaListef98ecd[Store]: Use SharedMutex in MetadataShard for better performance921645d[Store]: Address code review problems8c1e11b[Store]: Address code review problemsd666a82Fix typo8fc7d2eSimplify ObjectMetadata::IsValid📊 Changes
4 files changed (+343 additions, -134 deletions)
View changed files
📝
mooncake-store/include/master_service.h(+117 -31)📝
mooncake-store/include/mutex.h(+57 -0)📝
mooncake-store/src/master_service.cpp(+95 -103)📝
mooncake-store/tests/mutex_test.cpp(+74 -0)📄 Description
Description
Currently, we use
Mutexto ensure mutually exclusive access toMetadataShardduring concurrent operations. However, this mutual exclusion is unnecessary for concurrent read operations and actually leads to performance degradation. Therefore, we propose to replaceMutexwithSharedMutex. This will increase the parallelism of read operations, thereby improving Master's read QPS.We adopt RAII-style lock management for matadata shard. All access to the shards should be proxied through
MetadataShardAccessorROandMetadataShardAccessorRW.MetadataAccessoris also splitted intoMetadataAccessorROandMetadataAccessorRW.This PR also updated
MasterService:: GetReplicaListto acceptconst std::string&instead ofstd::string_viewas parameter.Type of Change
How Has This Been Tested?
The performance improvement is validated with
master_bench. The test configurations are as follows:The QPS results of 3 rounds of tests are as follows:
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.