Scheduler: make demand cap a share not a cost #3891
Closed
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.
Problem
There is currently a problem when
adjustedFairShare
is capped by demand.The scheduler caps
adjustedFairShare
tocost
at https://git.c3.zone/GR/armada/blob/69232402e78d1a420d56374415436fe15d2ebf0e/internal/scheduler/context/scheduling.go#L174However, when deciding whether to evict a job, it compares fair share to
actualShare = cost / totalCost
atarmada/internal/scheduler/preempting_queue_scheduler.go
Line 132 in 6923240
If
totalCost < 1
(which it often is in practice), dividing bytotalCost
inflatesactualShare
so that it thinksactualShare
is above fair share even for fairly undemanding users. So it evicts many jobs well below fair share.Solution
Divide
cappedShare
bytotalCost
so the adjustedFairShare demand cap is consistent with the eviction logic.