[YUNIKORN-3243] Add tests reproducing fair-share queue starvation and autoscaler blindness#1077
Open
shubhM13 wants to merge 2 commits into
Open
[YUNIKORN-3243] Add tests reproducing fair-share queue starvation and autoscaler blindness#1077shubhM13 wants to merge 2 commits into
shubhM13 wants to merge 2 commits into
Conversation
…the smaller queue first regardless of fair share ratio.
10 tasks
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.
What is this PR for?
This PR adds 20 tests (18 integration + 2 unit) that reproduce a critical scheduling bug where sibling queues with asymmetric guaranteed resources cause indefinite starvation of the smaller queue, make its pending asks invisible to the cluster autoscaler, and validates that the
priority.offsetqueue property eliminates the starvation.The Bug
When two sibling queues under the same parent have vastly different guaranteed resources (e.g., 3600:1 ratio), the fair-share queue sorting in
TryAllocatecauses the smaller queue to never be visited by the scheduling loop:sortQueuesByFairnessAndPrioritysorts children bymax(allocated/guaranteed)(dominant resource fairness)TryAllocatereturns on the first child success → smaller queue is never reachedSetSchedulingAttempted(true)(set insideapp.tryAllocate()at line 1035) is never called for the smaller queue's asksinspectOutstandingRequestsskips asks whereschedulingAttempted=false→ autoscaler never notifiedProduction impact: Platform health check jobs (spark-pi) starved for 9.5+ minutes during peak batch processing. No
PodUnschedulableevents emitted. Karpenter completely unaware capacity was needed.Config-level fix: Setting
priority.offseton the smaller queue causessortQueuesByPriorityAndFairness(the default sort withprioritySortEnabled=true) to sort by priority FIRST, overriding fair share. The smaller queue sorts first regardless of ratio, eliminating the starvation.Test Matrix
Files Changed
pkg/scheduler/tests/queue_starvation_test.gopkg/scheduler/scheduler_test.goIntegration Tests (
queue_starvation_test.go)All tests use the
mockSchedulerharness withMultiStepSchedule(manual scheduling mode).Core Bug Proof
TestQueueStarvationWithPriorAllocationschedulingAttempted=falseTestQueueStarvationSchedulingAttemptedFlagschedulingAttempted=falseControls (Expected Behavior)
TestQueueStarvationNoStarvationAtZeroTestStarvationWithEqualGuaranteesTestQueueStarvationTiebreakerRecoverySeverity Scaling
TestStarvationSeverityByRatio10:1(mild),100:1(moderate),3600:1(severe)Amplifiers
TestQueueStarvationContinuousDemandschedulingAttemptedstays false across all 20 cycles.TestUnplaceableAppsAmplifyStarvationTestReservedAllocatePriorityDocumentedtryReservedAllocateruns beforetryAllocateevery cycle, adding another starvation layer when combined with fair share asymmetry.Autoscaler Blindness
TestScaleUpTriggeredIsOneShotHasTriggeredScaleUp()stays true after setSetScaleUpTriggered(true)is called, the ask is permanently excluded from outstanding requests. The autoscaler gets exactly one chance.TestStarvedQueueNoEventsEmittedschedulingAttempted=false,scaleUpTriggered=falseCompounding
TestFullCompoundStarvationschedulingAttempted=false,scaleUpTriggered=false. Full production scenario reproduced.Recovery
TestStarvationRecoveryAfterDemandExhaustionFix Validation —
schedulingAttemptedat RegistrationTestSchedulingAttemptedSetOnRegistrationFixschedulingAttempted=trueon starved asktryAllocate), the autoscaler would detect the ask immediately. sparkpi is still starved (scheduling order unchanged), butschedulingAttempted=trueensuresinspectOutstandingRequestswill include it.Fix Validation —
priority.offsetConfig ChangeTestPriorityOffsetPreventsStarvationroot.small: priority.offset=1000,root.large: priority.offset=0TestPriorityOffsetWithContinuousDemandTestPriorityOffsetContrastWithoutFixpriority.offset, sparkpi is starved. Provespriority.offsetis the specific config change that eliminates starvation.Unit Test (
scheduler_test.go)TestInspectOutstandingRequestsSkipsUnvisitedQueuepartition.tryAllocate()andscheduler.inspectOutstandingRequests(). Proves that dominant queue asks (withschedulingAttempted=true) ARE included in outstanding requests, while starved queue asks (withschedulingAttempted=false) are NOT. The autoscaler signal is asymmetric.What type of PR is it?
Todos
What is the Jira issue?
[YUNIKORN-2] Gang scheduling interface parametersHow should this be tested?
Screenshots (if appropriate)
Questions: