-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Optimize Label parsing calls #8395
Conversation
For a simple label, this speeds up lookup of an existing simple label (no expression used): 16ns vs 106ns (6x faster)
* Store Set<LabelAtom> at Node descendants level * Compute it whenever labelString is updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotbugs and the failure in hudson.XmlFileTest.canReadXmlWithControlCharsTest
are left to address
Label#parse
for simple labelThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
@Vlatombe thanks for this improvement. It appears that the improvement causes one of the automated tests in the workflow durable task plugin to fail as shown in https://github.com/jenkinsci/bom/pull/2412/checks?check_run_id=16175702436 Thanks to @daniel-beck for detecting the issue and mentioning it in jenkinsci/bom#2412 (comment) Can you investigate that failure and propose a fix for the tests in the workflow durable task plugin so that a new version of workflow durable task plugin can be included in the plugin bill of materials? Without that fix, the plugin compatibility tests used for the plugin bill of materials will fail and block the next release of the plugin bill of materials. |
Hi @MarkEWaite this test failure has been addressed already - jenkinsci/workflow-durable-task-step-plugin#335 |
Thanks very much @Vlatombe ! I've triggered a dependabot update of the plugin bill of materials to bring the new release of the plugin into the BOM. |
FYI, this change likely broken our Jenkins instance. Jenkins fails to start after upgrading, and we are getting a null reference error
|
We got it to start by removing all of the nodes in the nodes folder, however after restarting it crashes again All of our nodes have labels, and the only nodes running at the time were EC2 @Vlatombe |
Filed jenkinsci/ec2-plugin#883 to fix the impacted plugin. Given this happened already with 2 plugins overriding |
Filed #8448 |
* Optimize Label#parse for simple label For a simple label, this speeds up lookup of an existing simple label (no expression used): 16ns vs 106ns (6x faster) * Fix reviews * Fix include * Avoid parsing label every time getAssignedLabels is called * Store Set<LabelAtom> at Node descendants level * Compute it whenever labelString is updated * Fix spotbugs / test issue * Make it restricted
this.label = Util.fixNull(labelString).trim(); | ||
this.labelAtomSet = Collections.unmodifiableSet(Label.parse(labelString)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caused JENKINS-71937, as label
doesn't get set
[JENKINS-71937] Fix deprecated Slave constructor Got broken in #8395 Co-authored-by: Basil Crow <[email protected]>
[JENKINS-71937] Fix deprecated Slave constructor Got broken in jenkinsci#8395 Co-authored-by: Basil Crow <[email protected]> (cherry picked from commit 6fdfdd0)
Optimize Label parsing related calls
Node#getAssignedLabels
parse Labels from scratch on every call. This ends up being called a lot viaJenkins#trimLabels
. Caching the set ofLabelAtom
allows to parse labels only if the label string is updated.Label#parse
has come up in performance testing involving a lot of cloud agents using one-shot labels.This speeds up lookup of an existing simple label (no expression used):
16 ns
vs.106 ns
(6x faster)Node#getAssignedLabels
LabelBenchmark.jenkinsGetAssignedLabels
:34ns
vs.41ns
, expected since Jenkins doesn't have any assigned label by default.NodeLabelBenchmark.nodeGetAssignedLabels
:91ns
vs.185ns
(2x faster)Testing done
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist