mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #1136] [Usage]: Question about master_exist_key_failures_total metric behavior #378
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#378
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 @tianlang-wq on GitHub (Nov 28, 2025).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/1136
Describe your usage question
Summary
I need clarification on when the
master_exist_key_failures_totalmetric is supposed to be triggered. After analyzing the code, I found that the current implementation rarely increments this counter.Current Behavior Analysis
Code Analysis
Looking at the
ExistKeyimplementation inmooncake-store/src/master_service.cpp:Issue
The function only returns
true/false(success cases) and never returns an error code like other operations do. The metricmaster_exist_key_failures_totalis incremented only when the RPC call fails (returns an error), butExistKeynever returns errors in normal operation.Current Metric Logic
In
rpc_service.cpp:The failure metric is only incremented when
!result.has_value()is true, butExistKeyalways returns a value.Questions
Design Intent: Is this the intended behavior? Should
ExistKeyonly fail on system-level errors, not on key misses?Metric Purpose: What is the intended purpose of
master_exist_key_failures_total? Should it track:Consistency: Other operations like
GetReplicaListreturn errors likeOBJECT_NOT_FOUNDwhen keys don't exist, butExistKeyreturnsfalse. Is this inconsistency intentional?Monitoring Use Case: How should users interpret this metric for monitoring? Currently it will almost always be 0, which might be confusing.
Context
This question arose while setting up monitoring for a Mooncake deployment. The
master_exist_key_failures_totalmetric is always 0, even during periods of high cache miss rates, making it unclear how to properly monitor cache performance.Environment
Would appreciate clarification on the intended behavior and best practices for monitoring cache hit/miss rates.
Before submitting a new issue...
@ykwd commented on GitHub (Nov 28, 2025):
This is a very good question.
There are two methods to compute the cache hit rate:
First:
cache hit rate = successful get request number / successful put request number.
For example, if I put 100 key–value pairs into the cache, and they are used 80 times in total, then the cache hit rate is 80%.
Second:
cache hit rate = successful get request number / total get request number.
For example, if I issue 100 get requests, and 80 of them successfully retrieve the item, then the cache hit rate is 80%.
The first method was introduced in this PR: https://github.com/kvcache-ai/Mooncake/pull/1020
However, after thinking about it, the first method is actually closer to a cache utilization rate. The second method is the real definition of cache hit rate.
The problem is that in our upper-layer application, the implementation may call
existbefore bothgetandput. As a result, it will onlygetobjects whereexist = true, and onlyputobjects whereexist = false. Because of this behavior, calculating the hit rate using the second method becomes somewhat difficult.@tianlang-wq commented on GitHub (Nov 28, 2025):
If master_exist_key_failures_total is used to determine cache hit rate, and now there's a better method #1020, will this metric be deprecated in the future?
@ykwd commented on GitHub (Nov 28, 2025):
I don't think master_exist_key_failures_total is used to determine cache hit rate
@tianlang-wq commented on GitHub (Nov 28, 2025):
Thank you for your answer. So, what is the purpose of master_exist_key_failures_total? Based on current code analysis, it appears this metric consistently remains at 0.
@tianlang-wq commented on GitHub (Nov 28, 2025):
If it calls exist 10 times, with 8 hits and 2 misses, then the 2 misses should correspond to master_exist_key_failures_total based on the code. Then, 8/10 would indeed be the hit rate. Is my interpretation correct?
@tianlang-wq commented on GitHub (Nov 28, 2025):
However, the issue I've discovered currently is that master_exist_key_failures_total remains consistently at 0, regardless of the state. This should be a bug in the logic, right?
@ykwd commented on GitHub (Nov 28, 2025):
Yes. In the current implementation, the
existRPC will always succeed on the master’s side. Returning eithertrueorfalseis expected behavior, so this metric doesn’t really provide meaningful information at the moment.@tianlang-wq commented on GitHub (Nov 28, 2025):
Thank you for your answer.