mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[GH-ISSUE #2519] [RFC]: Deadline-aware admission & adaptive degradation for TENT transfers #670
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#670
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 (Jun 17, 2026).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/2519
Originally assigned to: @catyans on GitHub.
Motivation
TENT already prioritizes traffic well at the ordering level (documented in
docs/source/design/tent/qos.md):PRIO_HIGH/MEDIUM/LOW,tent/common/types.h)workers.h,workers.cpp)promoteTimedOutRequests,workers.cpp)SharedSlotManager,shared_quota.h)quota.h,enable_priority_filtering)All of this answers "given a set of transfers, in what order do we send them?" What's still missing is the SLO question:
Three concrete gaps:
Requesthasprioritybut no deadline, so the scheduler can't tell "HIGH with 8 ms left" from "HIGH with 80 ms left."LocalTransferAdmissionQueue::pickForDispatch(admission_queue.cpp:185) admits/dispatches purely on outstanding bytes/owners in FIFO order. It cannot reshape or reject a transfer that provably can't meet its deadline.This is the SLO-guarantee capability implied by #1883 Milestone 3 that the ordering machinery alone cannot provide.
Scope
In scope:
deadline_nsfield onRequest(backward compatible).LocalTransferAdmissionQueue; default FIFO behavior unchanged when no deadline is supplied.Out of scope (kept as follow-up PRs to keep this mergeable):
Design
1. Deadline on the request
0⇒ behaves exactly as today (FIFO within priority). If the upper layer passes nothing, nothing changes. The connector (vLLM/SGLang) computes:TENT only consumes a deadline; it does not invent SLO numbers.
2. Feasibility metric (MLU)
All three inputs already exist:
remaining_bytes— fromRdmaTaskaccounting (transferred_bytesvs total).remaining_time—deadline_ns - now.available_bw— derived from the existingDeviceQuota::ewma_bandwidth_bps(quota.h:76) minus current in-flight load on the pinned device.MLU < 1feasible,MLU ≥ 1infeasible. It is a standardwork / (time × rate)feasibility ratio (effectively a laxity test). This direction is motivated by recent work on TTFT-SLO-aware flow scheduling for LLM serving — Multi-stage Flow Scheduling for LLM Serving (MFS, arXiv:2603.17456), which approximates Least-Laxity-First scheduling across reusable KV-block retrieval, collective communication, and P2D transfer to improve TTFT SLO attainment by 1.2–2.4×. MFS operates above the transfer layer; this RFC brings an equivalent laxity-driven decision into TENT's admission path, where it can also trigger degradation (compression / local decode) rather than only reorder.3. Admission decision (one-time, at submit)
< θ_compress(e.g. 0.3)θ_compress … θ_local(e.g. 0.3–1.5)≥ θ_local(e.g. 1.5)LOCAL_DECODE_SUGGESTED, do not transferθ_compress/θ_localare config knobs. Non-deadline traffic (deadline_ns == 0, e.g. Store offload) skips MLU and falls through to today's path.4. Dynamic re-evaluation (during transfer)
Re-compute MLU every N slices or M ms using live EWMA bandwidth:
θ_compress→ compress not-yet-posted slices.θ_local→ cancel remaining transfer, raiseLOCAL_DECODE_SUGGESTED.workers.cpp— no second mechanism.5. Integration point
pickForDispatch(max_owners, max_bytes)is the single, clean injection site (currently FIFO, and this class is runtime-private, not yet on the hot path):DeadlinePolicytoQueueLimits.θ_local(raising the signal).6. Degradation hook (interface only)
No hook registered ⇒ identical to current behavior: the
θ_compress…θ_localband degrades to plain full transfer, and≥ θ_localdegrades to best-effort full transfer.Estimated scope
Request.deadline_ns+ plumbingpickForDispatch(EDF + drop)Relation to #1883
Milestone 3's ordering layer is satisfied by the shipped priority queues + cross-process slots. This RFC adds the SLO layer on top — admission and degradation driven by a deadline, which ordering cannot express. Strictly additive, gated behind an opt-in deadline.
Open questions
deadline_nsonRequest(proposed) vs a per-batch side-channel hint?available_bwwith multiple devices: a transfer is pinned to a device at allocate time — is per-device EWMA sufficient, or is an aggregated view needed?Happy to open a PoC PR adding
deadline_ns+ the EDFpickForDispatchpolicy (no codec, no local-decode body) to validate the integration point.@github-actions[bot] commented on GitHub (Jun 17, 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 (Jun 22, 2026):
Quick status update — #2519 has been quiet here, but two adjacent threads moved in directions that bear directly on this RFC, so I want to thread them in for context before proposing the smallest possible first step.
Scheduler boundary (#2132) — @zbchi confirmed in #2132 (comment):
That's almost exactly the surface this RFC needs — a deadline channel into the same
LocalTransferAdmissionQueuerather than a separate scheduler. So #2519 should be able to land as a thin policy on top of #2132 rather than competing with it. I'll keep the integration point limited to what #2132 will already expose.Congestion control vs. QoS (#2489) — @alogfans noted in #2489 (comment):
This RFC is intended to be a peer of #2489 under that uniform mechanism, not a parallel one: AIMD reshapes the per-flow rate at the sender, while deadline-aware admission decides at submit time whether the transfer is feasible at all (and if not, whether to compress or hand back
LOCAL_DECODE_SUGGESTED). Both consume the same EWMA bandwidth estimator (DeviceQuota::ewma_bandwidth_bps,quota.h:76) and operate at distinct layers, so they should compose cleanly.Proposed minimal first step
Given the alignment above, I'd like to start with a much smaller PR than the full RFC and hold back everything debatable for follow-ups. Concretely just two pieces, ~30 LoC total, with no behavioral change unless the caller opts in:
Add
uint64_t deadline_ns = 0toRequest(tent/common/types.h:68).0⇒ today's behavior bit-for-bit, no plumbing intoTaskInfoor workers needed.At submit time, when
deadline_ns != 0, compute MLU as(
ewma_bandwidth_bpsis in bytes/s, perquota.h:81'sbw_gbps × 1e9 / 8.) Emit it as a histogram through the existing metrics module (tent/metrics/tent_metrics.h, alongside theread_latency_/read_size_precedents). Purely observability — no admission logic, no degradation hook, nopickForDispatchchange.That gives us a verifiable measurement of whether MLU is a useful signal on real workloads before any policy decisions land. The follow-up PRs — dynamic re-evaluation during transfer, EDF ordering inside
pickForDispatch, theθ_compress/θ_localthresholds, the degradation hook,LOCAL_DECODE_SUGGESTED— each become independent review units that can be dropped or rethought without affecting the others.@alogfans @stmatengss @zbchi — does this incremental shape work for you? If so I'll send the deadline-plumbing + MLU observability PR for review and follow up with each policy layer one at a time. Happy to drop or rework either part if the direction needs adjusting.
@alogfans commented on GitHub (Jun 24, 2026):
LGTM for the minimal first step (deadline_ns field + MLU observability only).
Let's see the MLU metrics on real workloads before adding policy logic.
@catyans commented on GitHub (Jul 6, 2026):
Progress update.
Step 1 (deadline plumbing + MLU observability) is merged — #2618. It adds the optional
Request.deadline_nsfield (0 = no deadline = today's behavior) and emits atent_deadline_mlu_permillehistogram at task completion, with no admission/scheduling/degradation logic yet — exactly the "observability first" scope approved above.MLU validated as a discriminating signal on H20. Built with
-DUSE_TENT -DTENT_METRICS_ENABLED, rantransfer_engine_bench -backend tentP2P and scraped the histogram under two deadline regimes:Same metric cleanly separates the two regimes, so MLU behaves as a meaningful feasibility signal — which was the prerequisite for adding any policy on top. (Caveat: single-box P2P RoCE, so absolute numbers aren't representative; the point is MLU's discrimination.)
Proposed follow-ups (each an independent, opt-in PR, gated on real-workload MLU data):
pickForDispatch(the injection point wired by #2562), so deadline-tight transfers dispatch first — no change when no deadline is set.LOCAL_DECODE_SUGGESTED(signal only; the recompute decision stays in vLLM/SGLang) when MLU ≥ threshold.Keeping this RFC open as the umbrella; will open the step-2 PR once the MLU signal has been observed on a production-like workload, per the note above.
@catyans commented on GitHub (Jul 6, 2026):
Follow-up: full MLU-vs-deadline distribution, and one gap worth flagging.
Extending the earlier two-point sanity check into a proper sweep on the same H20 / CX-7 200G RoCEv2 box (2 nodes, TENT backend, 1 MB reads, batch=8 / threads=2 to create contention). One prerequisite worth noting: on this multi-bond dual-NUMA host the rail attempts unreachable cross-NUMA devices and every transfer fails
modify QP to RTR(see #2758), which pins throughput at ~0.14 GB/s and makes MLU meaningless. Scoping the engine to the reachable NIC (via theMC_FILTER_NICenv I proposed in #2760) restores a clean ~24.7 GB/s single-stream baseline (~42 µs per 1 MB read) so the MLU numbers below are real.MLU vs deadline (post-hoc
tent_deadline_mlu_permille):Two takeaways for the policy step:
One gap I hit while measuring: MLU is only recorded on the read completion path — a
writewith a non-zerodeadline_nsproduces notent_deadline_mlu_permillesamples. All the numbers above are therefore from reads. Since P→D KV transfer is predominantlywrite, step 2 (and the observability itself) would want the MLU emission wired into the write completion path too. Happy to send a small PR for that if it's useful.Caveats unchanged: single HW gen, synthetic fixed-size load, deadlines set by the bench rather than a real SLO source — so this is still a controlled measurement, not a production trace. But it does show the metric behaves as needed and points to where the policy logic earns its keep.
@catyans commented on GitHub (Jul 6, 2026):
Correction to my previous comment — write does record MLU.
I claimed above that MLU is only recorded on the read path. That was wrong, and I want to correct it before it misleads the step-2 design. On a clean re-test (same setup,
--operation=write --deadline_us=200,MC_FILTER_NICscoping so the rail bug doesn't interfere), writes emit MLU exactly like reads:which matches the read result at the same deadline (mean 1.31). The recording site (
recordTaskCompletionMetrics) is opcode-agnostic — therecordDeadlineMLUcall sits outside the READ/WRITE branch — so both paths are covered. My earlier "read-only" observation was a measurement artifact from an earlier run, not a real gap. Apologies for the noise.So there is no write-side gap to fix before step 2 — the MLU signal is available for both directions, including the P→D KV write path. The rest of the previous comment (the deadline sweep, the ~200µs transition band where feasible/missed coexist, and EDF's leverage there) stands.
@catyans commented on GitHub (Jul 31, 2026):
Closing as implemented. The staged plan in this RFC has landed: #2618 added
deadline_nsand MLU observability, #2763 added opt-in EDF dispatch, and #2764 added deadline-infeasible drop plus the degradation hook. All changes preserve the no-deadline/default behavior. Any future policy expansion should be proposed separately with new workload evidence.