Merge pull request #103039 from tkashem/fix-102973

apf: calculation of dR/dt should use seats in use
This commit is contained in:
Kubernetes Prow Robot 2021-07-05 00:14:54 -07:00 committed by GitHub
commit a3c2028cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -413,9 +413,9 @@ func (qs *queueSet) syncTimeLocked() {
// been advancing, according to the logic in `doc.go`. // been advancing, according to the logic in `doc.go`.
func (qs *queueSet) getVirtualTimeRatioLocked() float64 { func (qs *queueSet) getVirtualTimeRatioLocked() float64 {
activeQueues := 0 activeQueues := 0
reqs := 0 seatsInUse := 0
for _, queue := range qs.queues { for _, queue := range qs.queues {
reqs += queue.requestsExecuting seatsInUse += queue.seatsInUse
if queue.requests.Length() > 0 || queue.requestsExecuting > 0 { if queue.requests.Length() > 0 || queue.requestsExecuting > 0 {
activeQueues++ activeQueues++
} }
@ -423,7 +423,7 @@ func (qs *queueSet) getVirtualTimeRatioLocked() float64 {
if activeQueues == 0 { if activeQueues == 0 {
return 0 return 0
} }
return math.Min(float64(reqs), float64(qs.dCfg.ConcurrencyLimit)) / float64(activeQueues) return math.Min(float64(seatsInUse), float64(qs.dCfg.ConcurrencyLimit)) / float64(activeQueues)
} }
// timeoutOldRequestsAndRejectOrEnqueueLocked encapsulates the logic required // timeoutOldRequestsAndRejectOrEnqueueLocked encapsulates the logic required