mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2791] [Feature Request]: Hierarchical Eviction with Assign / Evict / Fallback #725
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#725
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 @kanceler on GitHub (Jul 8, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2791
Originally assigned to: @kanceler on GitHub.
Describe your feature request
Discussion Draft: Hierarchical Eviction with Assign / Evict / Fallback
Background
The current type-aware eviction PR shows that Mooncake Store needs a way to distinguish eviction semantics across object data types. For example, Hidden State and KV Cache differ in cache granularity, reuse interval, recomputation cost, and serving impact. They should not always be ranked by the same global lease-time ordering.
However, if each new policy is implemented directly inside
MasterService, the master service will become increasingly complex as we add tenant-aware, type-aware, cost-aware, or other future eviction policies.One possible direction is to model eviction policy as a small set of composable operations rather than as policy-specific branches embedded in
MasterService.Core Idea
The policy layer can be expressed using three basic operations:
These operations are policy-side planning operations. They do not directly mutate metadata or remove replicas.
MasterServiceremains responsible for safe execution.Assign
Assignpartitions a candidate set by some dimension and assigns an eviction target to each child scope.The partition dimension can be tenant, object data type, model, priority, namespace, or another future policy dimension.
For example:
Inside each tenant, the policy can continue partitioning by object data type:
In this model, tenant and type are not hard-coded hierarchy levels in the framework. They are just different ways to use
Assign.The assigned target can be represented as a ratio or as bytes. For memory pressure, bytes are often the more natural responsibility unit, while ratios are useful for compatibility with the current
BatchEvictsemantics.Evict
Evictselects victims within the current scope according to that scope's ranking policy.It does not cross the scope boundary. For example, when running inside
tenant B / Hidden State, it only selects victims from Hidden State candidates belonging to tenant B.Different scopes can use different ranking policies:
Evictonly produces a planned victim list. It does not modify metadata, release quota, remove replicas, or interact with offload state.Fallback
Fallbackis used when child scopes fail to satisfy the lowerbound target of their parent scope. It selects additional victims inside the parent scope while relaxing the child partition boundaries.For example, if type-scoped eviction inside a tenant cannot satisfy that tenant's lowerbound target, the policy should first fall back within that tenant rather than immediately shifting pressure to other tenants:
This means the policy can select from all remaining candidates in tenant B, without strictly preserving the original type-level split.
If all tenant scopes together still cannot satisfy the global lowerbound target, the policy can then use a global fallback:
Global fallback should not degenerate into raw lease-time ordering. It should still be able to consider tenant pressure and type pressure, so that fallback does not systematically punish scopes that are not the main source of memory pressure.
Fallback only relaxes policy partition boundaries. It does not relax execution safety boundaries. Hard pin, soft pin, group semantics, offload behavior, replica refcount, quota accounting, and metadata correctness are still enforced by
MasterServiceduring execution.Composed Flow
Using these three operations, a hierarchical eviction policy can be expressed as:
This flow expresses several principles:
Relationship With MasterService
MasterServicedoes not need to understand each policy's internal rules. It only needs to provide the mechanism around policy planning:The candidate view can be produced by the existing metadata scan. It should contain object identity and a small set of policy-relevant attributes, such as tenant, data type, memory footprint, lease state, and pin state.
The candidate view should not be a full metadata snapshot. It should not copy complete
ObjectMetadata, replica lists, group membership, or segment state.When executing eviction,
MasterServiceuses the candidate reference to locate the real metadata again, revalidates whether the object is still evictable, and then handles group eviction, offload-on-evict, quota release, replica removal, metrics, and metadata erase.Therefore, the policy layer owns decision-making, while
MasterServiceowns mutation and correctness.Execution Feedback
Whether
Fallbackis needed should be based on actual execution progress, not only on the policy's estimated plan.A planned victim may fail during execution because:
For this reason,
MasterServiceshould execute each planned stage and report the actual evicted bytes or objects. If the actual result of child scopes does not satisfy the parent lowerbound, the policy flow proceeds to the correspondingFallback.This preserves the current revalidation model while allowing the policy layer to express hierarchical responsibility.
Why This Abstraction May Be Useful
This abstraction is more general than hard-coding a tenant/type hierarchy.
If a future policy needs a new dimension such as model, priority, object group, or business namespace, it can be expressed as another
Assignrule rather than a new top-level eviction framework.If a future object type needs a new ranking strategy, it can be expressed as a different
Evictpolicy for that scope.If a child scope cannot satisfy its target, the same
Fallbacksemantics can be reused instead of creating separate special cases for type fallback, tenant fallback, and global fallback.Summary
Assign / Evict / Fallbackcan serve as a minimal abstraction for hierarchical eviction policy.It can express:
while also supporting future dimensions.
More importantly, it separates policy decision-making from
MasterService, while preservingMasterServiceas the owner of metadata correctness and safe eviction execution.Before submitting a new issue...
@github-actions[bot] commented on GitHub (Jul 8, 2026):
Thanks for opening this issue, @kanceler!
156038601A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@github-actions[bot] commented on GitHub (Oct 7, 2026):
This issue has had no activity for 90 days and will be closed in 7 days if there is no further activity. Please comment or react if it should stay open.
@github-actions[bot] commented on GitHub (Oct 15, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.