Repository navigation
fix(scheduler): prevent fair-share queue monopolization - #47
Merged
Merged
Conversation
Gate tenant subqueues with engine-feedback capacity while keeping scheduler inflight authoritative and work-conserving. Refs: #45 Signed-off-by: David <12414531+DavidBellamy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
Fair-share requests shared one FIFO lane per priority class. A noisy tenant could consume every queued position before another tenant became locally eligible, so weighted fair queuing could not correct the monopoly. Enforced engine-feedback admission also remained a second handler-side gate rather than driving the scheduler's dispatch ceiling.
Closes #45.
Solution
Use one FIFO subqueue per tenant inside each priority lane, backed by a per-tenant occupancy ceiling shared across all four classes and the existing work-conserving partition budget. Present one local head per tenant to hierarchical WFQ. Feed the scheduler a total engine-feedback fleet ceiling while keeping
SlotPoolinflight authoritative.Scope
Adaptive fair-share coupling requires explicit admission partitions. The unpartitioned scheduler remains WorkerCapacity-only because a single adaptive cap cannot safely combine pressure from non-fungible model pools.
Changes
fair_share.max_queued_requests_per_tenant, defaulting to 64 and validated above zero.Test Plan
cargo test -p smg --lib --no-fail-fast: 1476 passed, 0 failed, 5 ignored.cargo test -p smg middleware::scheduler::queue::tests --lib: 16 passed.cargo test -p smg --test scheduler_admission_test queue_full_returns_429 -- --exact --nocapture: passed after one full-suite mock-worker readiness timeout.cargo clippy -p smg --all-targets -- -D warningspassed with four documented unrelated baseline allowances.cargo +nightly fmt --all -- --check: passed.cargo check -p smg-python: passed.git diff --check: passed.test_router_with_tracingstill received zero spans; the same test fails identically on untouched parent baselinec4a8a246, so this is not introduced by this patch.pkg-config/OpenCV. CI provides the repository's authoritative feature matrix.Checklist
cargo +nightly fmtpassescargo clippytarget passes with documented unrelated baseline allowances