fix(cache): include scheduler occupancy in owner pressure - #55
fix(cache): include scheduler occupancy in owner pressure#55DavidBellamy wants to merge 3 commits into
Conversation
Signed-off-by: David <12414531+DavidBellamy@users.noreply.github.com>
|
Canary update from the isolated two-engine Kimi K3 run:
The capacity race is tracked in #56 and fixed with deterministic regressions in draft PR #57. This PR should remain draft until a combined canary image includes #57 and the same 76-way A/B completes. The balanced-engine estimate is promising, but there is no treatment throughput claim yet. |
Signed-off-by: David <12414531+DavidBellamy@users.noreply.github.com>
This reverts commit b828e2a.
|
Canary correction (2026-08-07): the first isolated M1 A/B did not execute this change. The control and nominal treatment images contained the same compiled The later legacy I am rebuilding the original treatment with a source-specific Cargo target and will require the embedded |
|
Corrected isolated M1 canary result (job The earlier A/B artifact was invalid because its nominal treatment and control images loaded the same compiled Runtime provenance in this run:
Workload and isolation:
Matched result:
Both arms completed 228/228 turns with zero terminal failures, 429 retries, retractions, or CUDA OOMs. The treatment made 10 bounded The fail-closed analyzer intentionally exited nonzero on three caveats, so I am keeping this PR in draft and am not recommending production activation yet:
The complete analyzer is at Next gates before merge/activation: code-owner review, fixed-trace or task-quality parity, then a multi-engine canary with admission enforcement rather than shadow mode. |
|
Enforced-admission follow-up (M1 job The 182.595 successful output tok/s/node shadow result above is real, but this PR is not sufficient for the current production admission path by itself. Source audit shows that HTTP adaptive admission runs before The five-node M1 follow-up reproduced the exact live state in two consecutive one-second gateway samples using the provenance-verified treatment binary:
Snapshot artifacts:
At that state the current EngineFeedback decision is deterministically I am deliberately classifying this as source-plus-live-state evidence, not an endpoint 429 measurement. The one-shot probe wrapper rejected a zero-retry CLI argument and the fail-closed cleanup stopped the gateway before a replacement raw probe could be sent. The harness is corrected for a future rerun; no production process was touched, and all five nodes returned idle. I also prototyped a distribution-headroom admission rule in an unpublished worktree. It bypasses both the waiter gate and a skewed learned knee only with complete per-replica load/cap telemetry, a distinct clean peer, and aggregate hard-cap headroom. Formatting/diff checks and 24 targeted Rust tests pass, including hot-owner/idle-peer, learned-knee, full-saturation, and incomplete-telemetry cases. It is not merge-ready: the admission controller cannot yet prove owner-pressure routing is enabled, and a one-request relaxation can close again as soon as the waiter clears. The safe design needs an explicit routing-policy opt-in plus a bounded one-in-flight seeding lease/cooldown. This PR should remain draft. Required next gate: couple distribution-aware admission to owner-pressure routing, then rerun the corrected enforced canary before code-owner review and activation. |
Description
Problem
Cache-aware engine-load routing currently defines pressure as the larger of KV token usage and utilization. A Kimi K3 engine can therefore remain a suitable cached owner while its scheduler is full and has a large waiting queue, so cache affinity keeps feeding that owner while other healthy engines stay idle.
On the observed M2 workload, hot owners reached the 37-request cap with up to 116 waiting requests while most of the 50-engine pool was idle. This PR only changes routing pressure. It does not change adaptive-admission ordering or enable the feature in production.
Solution
Include scheduler occupancy in per-worker pressure when every healthy candidate reports a positive max-running cap for every DP rank:
pressure = max(token_usage, utilization, (running + waiting) / max_running)The existing 90% high watermark, 10-point owner slack, replication ceiling, cooldown, and provisional-owner coalescing remain unchanged. If any candidate has missing, partial, or stale cap telemetry, the entire decision falls back to the existing backend pressure. This avoids false spills from incomplete multi-DP caps and from SGLang Prometheus fallback counts that may be duplicated across TP ranks.
Refs #11.
Changes
Test Plan
Local verification:
cargo +nightly fmt --all -- --checkgit diff --checkcargo test -p smg policies::cache_aware --lib(53 passed)cargo test -p smg --lib(1,477 passed, 5 ignored)The repository-wide
cargo clippy --all-targets --all-features -- -D warningsremains blocked on the unchanged base by existing Rust 1.94 lint failures and this Mac's missingpkg-config/OpenCV dependency. Repository-widecargo testalso fails compiling existingopenai-protocolbuilder tests that omit theotherfield. Neither failure touches this diff.Before production use, run an isolated M2 routing canary on the same TP16 engines and growing-prefix trace:
Checklist
cargo +nightly fmtpassescargo clippy --all-targets --all-features -- -D warningspasses (blocked by unchanged base and local OpenCV tooling, detailed above)