mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #451] [MERGED] [Store] High Availability 1: Master Failover #1574
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#1574
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/451
Author: @ykwd
Created: 6/5/2025
Status: ✅ Merged
Merged: 6/11/2025
Merged by: @xiaguan
Base:
main← Head:feature/ha📝 Commits (10+)
2896379A temp version. Better to continue development after merging the latest main branch483762fResolve merge conflictsb1abc1fTemp version to merge the latest main branch8c87ecbmerge main0bbcef9Allow optional use HA mode, in default use non-HA mode. Fix a minor metrics bug.fb55405Refactor the etcd_helper6e10b11refactor ha_helper778f2c4Add some unit tests. Refactor the codeaa60561Update cmakelists: build etcd_wrapper in default3df656cMerge main📊 Changes
21 files changed (+1453 additions, -101 deletions)
View changed files
📝
.github/workflows/ci.yml(+10 -0)📝
mooncake-common/CMakeLists.txt(+2 -2)📝
mooncake-common/etcd/etcd_wrapper.go(+301 -10)📝
mooncake-store/CMakeLists.txt(+4 -1)📝
mooncake-store/include/client.h(+18 -4)➕
mooncake-store/include/etcd_helper.h(+102 -0)➕
mooncake-store/include/ha_helper.h(+111 -0)📝
mooncake-store/include/master_client.h(+8 -0)📝
mooncake-store/include/master_metric_manager.h(+3 -0)📝
mooncake-store/include/rpc_service.h(+75 -14)📝
mooncake-store/include/types.h(+12 -0)📝
mooncake-store/src/CMakeLists.txt(+6 -2)📝
mooncake-store/src/client.cpp(+148 -15)➕
mooncake-store/src/etcd_helper.cpp(+151 -0)➕
mooncake-store/src/ha_helper.cpp(+181 -0)📝
mooncake-store/src/master.cpp(+61 -42)📝
mooncake-store/src/master_client.cpp(+27 -1)📝
mooncake-store/src/master_metric_manager.cpp(+14 -2)📝
mooncake-store/src/types.cpp(+5 -0)📝
mooncake-store/tests/CMakeLists.txt(+5 -8)...and 1 more files
📄 Description
Currently, the high availability goal consists following contents:
The client can detect when the master goes down and automatically remount segments after the master restarts. This way, if the master crashes, only the master needs to be restarted without having to restart the entire cluster.
The master service contains multiple instances, one of which is the leader and serves the client requests. When the current leader fails, other instances can campaign to become the new leader and continue providing services. However, since the previous metadata is lost, it's equivalent to the cluster's key-value store being cleared, requiring the cache to be repopulated.
Tolerant client failure. The master can detect when a client fails and mark its associated data as invalid. When the client comes back online, it can re-register with the master.
KV metadata failover. Persist or replicate the kvs' metadata so that the newly elected leader can sync to the latest state, and the previously existing key-value data is still preserved.
Add fault-tolerant logic to the existing code to make the system more robust.
Add more tests to validate the robustness of the system under various failures.
This PR is the first step of a series of attempts to make mooncake-store achieve high availability. This PR achieves the 1st and 2nd goals listed above.
More precisely, this PR adds an optional HA mode that depends on etcd service. In HA mode, users can deploy multiple master instances, and at any time, only one instance is the leader to serve client requests. If N instances are deployed, the cluster can tolerate at most N-1 instances fail as long as the etcd service is alive. Currently, we also support non-HA mode, which is the default mode, and the system behaviour is equivalent to before.
As the high availability depends on etcd service, the installation of go and the compilation of etcd-wrapper become necessary if mooncake-store is to be compiled. Both mooncake-store and transferengine have an independent etcd client instance, so they won't interfere with each other.
Additionally, to do the corresponding unit tests in CI, we also need to deploy etcd service in the CI environment.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.