Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid evicting queues below their fair share #2611

Merged
merged 8 commits into from
Jun 27, 2023

Conversation

severinson
Copy link
Contributor

@severinson severinson commented Jun 27, 2023

This PR introduces a new config protectedFractionOfFairShare. Only queues allocated more than this fraction of their fair share are considered for preemption.

┆Issue is synchronized with this Jira Task by Unito

@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Patch coverage: 42.10% and project coverage change: -0.06 ⚠️

Comparison is base (fbff206) 58.85% compared to head (31c4a85) 58.80%.

❗ Current head 31c4a85 differs from pull request most recent head 5502b63. Consider uploading reports for the commit 5502b63 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2611      +/-   ##
==========================================
- Coverage   58.85%   58.80%   -0.06%     
==========================================
  Files         238      238              
  Lines       30551    30535      -16     
==========================================
- Hits        17982    17957      -25     
- Misses      11200    11213      +13     
+ Partials     1369     1365       -4     
Flag Coverage Δ
armada-server 58.80% <42.10%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/armada/server/lease.go 7.54% <0.00%> (-0.03%) ⬇️
internal/scheduler/common.go 85.49% <ø> (-0.74%) ⬇️
...nternal/scheduler/schedulerobjects/resourcelist.go 67.52% <0.00%> (-1.80%) ⬇️
internal/scheduler/context/context.go 33.50% <40.00%> (-0.18%) ⬇️
internal/scheduler/preempting_queue_scheduler.go 64.68% <48.00%> (-0.76%) ⬇️
internal/scheduler/queue_scheduler.go 65.50% <66.66%> (+0.34%) ⬆️
internal/scheduler/scheduling_algo.go 72.62% <66.66%> (+0.15%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -469,7 +469,8 @@ func (q *AggregatedQueueServer) getJobs(ctx context.Context, req *api.StreamingL
schedulerobjects.ResourceList{Resources: totalCapacity},
)
for queue, priorityFactor := range priorityFactorByQueue {
if err := sctx.AddQueueSchedulingContext(queue, priorityFactor, allocatedByQueueAndPriorityClassForPool[queue]); err != nil {
weight := 1 / priorityFactor
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it so that the scheduling contexts store the weight instead of the priority factor.

@@ -490,6 +496,19 @@ func (qctx *QueueSchedulingContext) ClearJobSpecs() {
}
}

// FractionOfFairShare returns a number in [0, 1] indicating what fraction of its fair share this queue is allocated.
func (qctx *QueueSchedulingContext) FractionOfFairShare() float64 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fair share computation is now done in the context. This is necessary now that several components (the eviction and the queue multiplexing) now need it.

return false
}
if qctx, ok := sch.schedulingContext.QueueSchedulingContexts[job.GetQueue()]; ok {
if qctx.FractionOfFairShare() <= sch.protectedFractionOfFairShare {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the line of code preventing queues at or below their fair share from being preempted.

@severinson severinson merged commit d6aef28 into master Jun 27, 2023
@severinson severinson deleted the severinson/protected-fair-share branch June 27, 2023 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants