mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #3158] [RFC]: Decouple Mooncake Store business logic from metrics #813
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#813
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 @Aionw on GitHub (Jul 28, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/3158
Summary
Mooncake Store currently uses observability gauges as inputs to several business decisions. This reverses the intended dependency direction:
Metrics should be a lossy, replaceable projection of runtime state. Disabling, resetting, restoring, or changing the metrics implementation must not change eviction, promotion, or replica-placement behavior.
This RFC proposes to move all business reads to authoritative internal state, keep metrics write-only from business code, and derive storage gauges from domain snapshots.
Motivation
Depending on metrics for correctness is counterintuitive and fragile:
The rule should be:
Current coupling audit
The audit covered production code in Mooncake Store, Transfer Engine, TENT, PG, and EP. Tests, benchmarks, admin summaries, and RPCs whose explicit purpose is to expose metrics are classified separately.
True control-flow dependencies
MasterMetricManager::get_global_mem_used_ratio()inMasterService::EvictionThreadFuncBatchEvicttarget/lower bound. Runs every 10 ms.MasterMetricManager::get_global_nof_used_ratio()inMasterService::EvictionThreadFuncNoFBatchEvicttarget/lower bound.MasterMetricManager::get_global_mem_used_ratio()inMasterService::TryPushPromotionQueueThese three reads are the correctness coupling this RFC must remove.
The promotion dependency originated in RFC #2031 and landed in PR #2071. This RFC does not change promotion policy; it changes the source of the watermark signal.
Metrics-named domain dependency
SsdFreeRatioFirstAllocationStrategyconsumesSsdMetricsProviderto rank segments. The provider is implemented byScopedLocalDiskSegmentAccessand readsLocalDiskSegment::ssd_total_capacity_bytesplusssd_used_bytes.This path affects replica placement, but it does not read Prometheus/ylt metric instruments. It already reads internal state; the abstraction is misleadingly named. It should be renamed to a domain concept such as
SsdUsageProviderorLocalDiskUsageView, with explicit state invariants.This path landed in PR #2450 and is complementary to the true metric-instrument coupling above.
Observability-only reads
The following are valid and are not business dependencies:
No production business decision outside Mooncake Store was found to read an exported metric value.
Goals
Non-goals
@github-actions[bot] commented on GitHub (Jul 28, 2026):
Thanks for opening this issue, @Aionw!
41376987A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@Hubert-Zhu commented on GitHub (Aug 2, 2026):
Hi @Aionw.
I am new to the this project and this RFC sounds very reasonable and have a well-definited scope. I am wondering if I can pick up this as my first onboarding task.
I did some POC with vibe-coded some draft PRs. But, before offically implementation, I have some qustions.
About design decision:
I am trying to understand the recovery flow. For a domain-owned O(1) usage state in SegmentManager, do we need to add some HA/snapshot restore change to rebuild that state? Otherwise, I am not sure if it may get into the bookkeeping problem.
About workflow/ how to contribute:
This is clear a mid-scoped change. Do we usually do 1 big PR or stack of small PRs?
@Hubert-Zhu commented on GitHub (Aug 3, 2026):
Synced with @Aionw through Slack. I will set the target date to Aug/10 for this task.
@Hubert-Zhu commented on GitHub (Aug 10, 2026):
https://github.com/Hubert-Zhu/Mooncake/pull/4. still need a bit more time to bake.