mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2866] [RFC]: TENT Hierarchical QoS Budget Enforcement and Work-Conserving Scheduling #745
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#745
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 @catyans on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2866
Summary
This RFC proposes hierarchical QoS budget enforcement for TENT: a default-disabled, work-conserving scheduler that turns an effective QoS Contract into bounded runtime service.
The QoS Contract in #2856/#2857 defines fields such as:
Those fields currently describe policy but do not enforce a shared resource budget. Existing priority/deadline ordering, local Admission limits, sender-local byte credits, and receiver-advertised credits solve different parts of the problem:
The scheduler should provide, within an explicitly defined enforcement scope:
This is a design RFC. Production enforcement PRs are explicitly gated on the prerequisites listed below. The first implementation milestone should be a pure model/simulator and shadow accounting; it must not change default dispatch behavior.
Why this RFC is separate from the QoS Contract
#2856 answers:
This RFC answers:
Keeping the schema and enforcement separate allows:
Motivation
TENT already has useful QoS building blocks:
These mechanisms do not yet provide a complete multi-tenant budget contract.
1. Priority is ordering, not isolation
Strict priority can protect foreground traffic, but it can starve background work indefinitely. Aging can reduce starvation, but promotion alone does not enforce a tenant cap or a long-term weighted share.
2. A cap must aggregate requests
Per-request or per-flow limits can be bypassed by splitting one workload into many requests, flows, policies, or sender processes. Enforcement must aggregate by an authenticated budget subject such as tenant + intent.
3. Idle capacity should not be wasted
Static reservations can leave NIC bandwidth unused when a guaranteed class is idle. A production scheduler should let other eligible classes borrow idle capacity while ensuring that the owner can reclaim service within a bounded interval.
4. Local capacity and receiver capacity are different
A sender may have local dispatch budget while the receiver has no staging/consumer/QP capacity. Conversely, receiver credit is a capacity reservation, not proof that the sender's tenant is authorized to consume that share.
5. Direct and Staged plans have different costs
Charging only
Request.lengthcannot correctly account for staging buffers, repeated device copies, receiver/consumer slots, QP/CQ pressure, or fallback paths. Enforcement needs #2863's plan-level resource vector.6. A local scheduler cannot claim a cluster-wide guarantee
If sixteen independent senders each enforce “tenant A may use 40 Gbps” locally, aggregate traffic can greatly exceed 40 Gbps at one receiver. v1 must state its enforcement scope honestly and use receiver-side allocation or future coordination for aggregate guarantees.
Prerequisites and implementation gate
Opening this RFC does not authorize immediate production scheduler changes.
ResourceChargemodel for at least Direct and Staged pathsQosSubjectsource or explicit single-tenant-only scopeBefore these gates are met, acceptable work is limited to:
Goals
Non-goals
Terminology
Budget subject
The authenticated entity charged by the scheduler:
The exact hierarchy may omit levels that are not configured, but tenant identity must come from a trusted connector/Store/control-plane context. An arbitrary request string is not sufficient authorization.
Enforcement scope
Where a budget is actually enforced:
ENGINE_LOCAL: one TENT engine/process;RECEIVER_LOCAL: aggregate grants at one receiving TENT instance;HOST_LOCAL: multiple engines coordinated on one host;CLUSTER_GLOBAL: future coordinated scope.Every configured budget and every metric must identify its scope. v1 should implement
ENGINE_LOCAL;RECEIVER_LOCALcan follow through receiver-credit allocation. It must not label either one as cluster-global.Guarantee, cap, and weight
min_bandwidth: target minimum service under contention when total guarantees and physical capacity are feasible;max_bandwidth: long-term ceiling, subject to the configured burst;weight: relative share of excess capacity after eligible guarantees are served;burst_bytes: bounded short-term usage above the steady cap;max_inflight_*: bounds admitted but unfinished work, independent of rate.The term “guarantee” should be used carefully. If telemetry is missing, capacity drops, or configured minimums exceed capacity, TENT can provide deterministic proportional degradation and report a violation, not create bandwidth that does not exist.
Borrowing
Borrowing means an eligible class uses capacity that another class is not currently using. Borrowed service is opportunistic and is not a debt that must later be repaid by starving the borrower. Reclaim means stopping new excess dispatch for borrowers and resuming the owner's eligible service within a bounded dispatch quantum/inflight window.
Proposed hierarchy
Limits apply at every configured level:
Proposed budget model
The exact layout is not fixed, but the model should cover:
“Units” are bytes in the first network-budget implementation. Later plan resources can use typed dimensions rather than pretending QP slots or staging slots are bytes.
All arithmetic must be overflow checked and use monotonic time. Refills should be computed lazily or in bounded scheduler ticks; a background timer per class is not acceptable.
Scheduling model
The proposed v1 algorithm combines three layers:
1. Eligibility and hard limits
A request is eligible only when:
Admission of one submit call remains atomic. A request must not consume a tenant token while failing to obtain the staging/receiver resource needed to complete.
2. Guaranteed service
For active classes with configured minimum target rates, accrue a bounded guarantee deficit. Under contention, serve eligible guaranteed deficit before distributing excess.
The implementation must cap accumulated idle deficit. An idle class cannot return after a long absence with an unbounded token stockpile and block all other traffic.
3. Excess service
After currently eligible guaranteed service, distribute excess capacity among eligible classes using DRR/WDRR based on configured weights.
DRR quantum should be large enough to avoid excessive scheduler overhead but small enough to bound reclaim and latency. The quantum and maximum dispatch batch become part of the observable contract.
4. Work-conserving borrowing
If a class has no eligible work, its currently unused capacity is available to siblings subject to their caps. When the owner becomes active:
5. Intra-class ordering
Within one budget class:
6. Infeasible requests
If a request cannot meet its deadline under the effective budget and current capacity:
The enforcement layer does not implement compression or recompute itself; it emits the authorized decision/hook.
Resource accounting
Phase 1: network-byte budget
The first enforcement PR should limit scope to one well-defined constrained resource, such as bytes dispatched through a selected NIC/rail capacity domain.
This phase validates:
It should not pretend to solve multi-resource fairness.
Phase 2: plan resource vector
After #2863 stabilizes, a plan may charge:
Resources have different owners:
The plan computes the charge; each resource owner reserves its dimension. Eligibility requires an atomic all-or-nothing reservation protocol at the Admission boundary, with rollback on failure.
Avoiding double charge for Staged paths
A staged user request and its internal transfers must share one parent plan/attempt identity.
Receiver-side allocation
Receiver Credits answer “what capacity has this receiver reserved for this sender/class?” They do not by themselves enforce tenant entitlement.
For many-to-one traffic, a future receiver-local allocator can divide receiver capacity by authenticated budget subject:
Rules:
This is Phase 2+ and depends on agreement about the production receiver-credit control path.
Capacity input and feasibility
Rate enforcement requires an explicit capacity domain.
Capacity input should include:
Rules:
Configuration validation
Reject or warn on:
min_rate > max_rate;tent check-configfrom #2864 should show the hierarchy, aggregate rates, oversubscription, enforcement scope, and restart/runtime requirements.Priority authorization and tenant identity
The scheduler must never trust arbitrary request fields as authority.
Required properties:
policy_nameremains authorization checked;The authentication mechanism itself is outside this RFC, but production multi-tenant enforcement is blocked until a trusted identity source exists. In single-tenant deployments, v1 may use an explicit fixed subject and clearly label the scope.
State bounds and lifecycle
Budget state must be bounded:
Decision and explain model
Each Admission decision should have a bounded internal reason:
Example sanitized explain:
Per-request explain belongs in trace/sample/CLI queries, not as unbounded Prometheus labels.
Metrics
Required aggregate metrics per bounded configured class/scope:
Benchmark-derived metrics:
Compatibility and rollout
Suggested modes:
Rules:
Proposed PR sequence
PR0: Model, simulator, and trace replay
Allowed before production prerequisites merge:
PR1: Shadow accounting adapter
After stable QoS Contract and minimal ResourceCharge:
PR2: Engine-local inflight cap and rate cap
PR3: Guarantee/excess DRR and borrowing
PR4: Staged plan accounting
PR5: Receiver-local tenant allocation
Later work
Correctness invariants
The model and implementation must prove/test:
Validation plan
Deterministic model tests
CPU integration tests
Real-cluster workload matrix
Use
tebenchon the H20/RoCE cluster with at least:For each run report:
Required scenarios
Claims boundary
No performance/SLO claim should be made from light-load averages. Offered load must cross the congestion point, and results must include isolation, fairness, integrity, and total utilization.
Expected benefits
If prerequisites and invariants are satisfied, this RFC should provide:
It does not provide a hard cluster-wide SLA in v1. Any result must be labeled by actual enforcement scope and capacity assumptions.
Relationship to existing work
ResourceCharge.Open questions
min_bandwidth_gbpsbe named/documented as a target minimum rather than a hard guarantee when capacity is infeasible?ResourceChargeis accepted, or may a network-byte-only shadow prototype proceed earlier?Before submitting a new issue...
@github-actions[bot] commented on GitHub (Jul 12, 2026):
Thanks for opening this issue, @catyans!
18214026A maintainer will triage this when possible. To help us respond faster, please include:
Useful links: Documentation · Contributing guide
@catyans commented on GitHub (Jul 12, 2026):
Deterministic shadow-scheduler experiment (2026-07-13) to test the core enforcement hypothesis before touching Admission. This is simulation evidence only.
Environment: Lingjun H20
lingjun-099, Python 3.12.7 / NumPy, fixed seed 20260713. Model: 10,000 x 1 ms epochs, capacity 100 work units/epoch; foreground arrivals Poisson(40/epoch), background Poisson(90/epoch), foreground deadline 5 epochs. Compared a single unbiased FIFO against a work-conserving 60/40 class budget; unused foreground capacity was borrowed by background.Results:
Conclusion: under sustained aggregate overload, explicit class budgets can protect feasible foreground demand while remaining work-conserving; the benefit is not higher total throughput (both are 100% utilized), but controlled allocation. The cost is explicit: background service fell by 92,159 units and its backlog grew, so aging/reclaim and overload policy are mandatory. This does not validate real TENT timing, hierarchical identity, byte-vs-request accounting or distributed guarantees. A code PR should begin in shadow-accounting mode and reproduce this comparison with tebench and real RDMA before enforcement is enabled.
@github-actions[bot] commented on GitHub (Oct 11, 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 19, 2026):
Closing due to 3 months of inactivity. If this is still relevant, please comment and we can reopen.