Optimize MappingWorksheet to avoid calling Task.getEstimatedDuration#11293
Merged
Conversation
jtnord
approved these changes
Nov 13, 2025
Member
jtnord
left a comment
There was a problem hiding this comment.
🤷 this is the first time I even came across this class.
MarkEWaite
approved these changes
Nov 14, 2025
Contributor
MarkEWaite
left a comment
There was a problem hiding this comment.
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.
/label ready-for-merge
6 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.
Amends the rather old 0ff811f by trying to avoid calling
Queue.Task.getEstimatedDuration()unless it is actually helpful to do so. Follows up my #7998 which did make this call faster in many cases; still, flame graphs show that in a heavily loaded controller, a major source of contention on theQueuelock is theMappingWorksheetconstructor and the calculations it performs.JobOffers at all, so the loop will not run and there is no purpose in even asking for the estimated duration.jenkins/core/src/main/java/hudson/model/queue/LoadPredictor.java
Lines 40 to 42 in 320a149
DumbSlaveas the definition of permanent agent; use ofjenkins/core/src/main/java/hudson/slaves/AbstractCloudSlave.java
Line 40 in 320a149
Testing done
Original performance problem observed sometimes under load in a CloudBees CI high availability controller. The patch appears to help, though running a controlled experiment is difficult.
So for only tested semi-interactively using functional tests in CloudBees CI representing various scenarios of cloud agents only, permanent agents only, or a mixture but the specific queue item is requesting a cloud agent label, and confirming that the appropriate
FINElog message is printed. Other than the fairly low-level mock test, I did not find any existing functional tests that would confirm the purpose and effectiveness of theMappingWorksheetlogic in the context of a realQueue.maintain.Proposed changelog entries
Proposed changelog category
/label rfe
Proposed upgrade guidelines
N/A
Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered (see query).