perf: parallelize user directory scanning and XML unmarshaling at sta… - #27063
perf: parallelize user directory scanning and XML unmarshaling at sta…#27063rajat315315 wants to merge 6 commits into
Conversation
|
Please complete the "testing done" section of the pull request template. The comment says:
Please explain why you checked the box for "has automated tests" but only changed production code, without adding an automated test. |
There was a problem hiding this comment.
Pull request overview
This pull request speeds up Jenkins startup user indexing by parallelizing the on-disk user directory scan and config.xml unmarshaling performed in hudson.model.User.AllUsers#scanAll.
Changes:
- Switch user directory iteration from a sequential
forloop to a parallel stream. - Preserve existing per-user failure handling behavior (skip invalid directories / missing or unreadable
config.xml/ invalid IDs) while allowing other users to load concurrently.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MarkEWaite
left a comment
There was a problem hiding this comment.
Thanks for the pull request.
Please complete the "testing done" section of the pull request description. Include a description of the interactive testing you performed to assure that the change is ready for large scale use.
Please provide one or more automated tests that address the concerns raised in the GitHub Copilot review of the pull request.
…onfiguration files
|
I created an installation with over 40000 users with the following script in the Groovy script console: I saw no issues starting with that many users. The "Manage Jenkins" / "Users" page is slow to render because it does not use pagination to limit the number of rows shown to the user, but that is a pre-existing condition that is not changed by this pull request. |
… to prevent thread pool exhaustion
MarkEWaite
left a comment
There was a problem hiding this comment.
Build fails on ci.jenkins.io and will fail for you locally if you run mvn -DskipTests clean verify. Please fix the build failure. Maintainers should not spend time reviewing pull requests that fail to build.
|
I am sorry @MarkEWaite to ask this, but can I contribute another PR? My motivation is to make Jenkins run super smooth and resolve all bottlenecks. |
Wait until this is merged.
That's a great motivation, but one of the most important bottlenecks is to learn the patterns of working with this repository. As an example, you haven't documented large scale testing that you've done, similar to the testing that I did. I asked for it earlier when I wrote:
|
Includes pull requests: * jenkinsci/jenkins#27080 * jenkinsci/jenkins#27078 * jenkinsci/jenkins#27075 * jenkinsci/jenkins#27074 * jenkinsci/jenkins#27073 * jenkinsci/jenkins#27072 * jenkinsci/jenkins#27063 * jenkinsci/jenkins#26923 * jenkinsci/jenkins#26922 * jenkinsci/jenkins#26913 * jenkinsci/jenkins#26880 * jenkinsci/jenkins#26833 * jenkinsci/jenkins#26690 * jenkinsci/jenkins#26668 * jenkinsci/jenkins#26600 * jenkinsci/jenkins#25920 * jenkinsci/jenkins#11216 * jenkinsci/jenkins#10432
Includes pull requests: * jenkinsci/jenkins#27080 * jenkinsci/jenkins#27078 * jenkinsci/jenkins#27075 * jenkinsci/jenkins#27074 * jenkinsci/jenkins#27073 * jenkinsci/jenkins#27072 * jenkinsci/jenkins#27063 * jenkinsci/jenkins#26923 * jenkinsci/jenkins#26922 * jenkinsci/jenkins#26913 * jenkinsci/jenkins#26880 * jenkinsci/jenkins#26833 * jenkinsci/jenkins#26690 * jenkinsci/jenkins#26668 * jenkinsci/jenkins#26600 * jenkinsci/jenkins#25920 * jenkinsci/jenkins#11216 * jenkinsci/jenkins#10432
We're a little busy at the moment, so do not expect this review any time soon. FWIW I don't see anything obviously security-critical here. |
…ll analysis in VS Code settings
There was a problem hiding this comment.
When this pull request is included in a Jenkins build in the Jenkins acceptance test harness, it fails tests as noted in pull request:
Those test failures must be resolved before this can be merged.
When this pull request is run in a Jenkins build in the Jenkins plugin Bill of Materials, it fails tests as noted in pull request:
Those test failures must be resolved before this can be merged.
|
Let me fix them. |
|
Acceptance Test Harness (ATH) Verification To verify my fix, I ran the tests locally against my compiled Jenkins war: Javadoc Tests: PATH=/home/rajat/maven/apache-maven-3.9.9/bin:$PATH JENKINS_WAR=/home/rajat/jenkins/war/target/jenkins.war BROWSER=firefox mvn test -Dtest=JavadocPluginTestResult: BUILD SUCCESS (3/3 tests passed). |
|
I will keep in mind to run Acceptance Test Harness (ATH) Verification from next time onwards. |
|
@MarkEWaite Could you brief about the merging process? Like will it take time to merge? |
The pull request must be reviewed by the security team before it can be merged. They are very busy and don't know when they will be able to review it. I'm unwilling to merge it until they've reviewed it. It has passed the acceptance test harness and the plugin compatibility tester. |
Generated with core pull request: * jenkinsci/jenkins#27206 Includes pull requests: * jenkinsci/jenkins#27205 * jenkinsci/jenkins#27201 * jenkinsci/jenkins#27193 * jenkinsci/jenkins#27163 * jenkinsci/jenkins#27088 * jenkinsci/jenkins#27083 * jenkinsci/jenkins#27067 * jenkinsci/jenkins#27065 * jenkinsci/jenkins#27063 * jenkinsci/jenkins#27032 * jenkinsci/jenkins#26923 * jenkinsci/jenkins#26922 * jenkinsci/jenkins#26913 * jenkinsci/jenkins#26880 * jenkinsci/jenkins#26690 * jenkinsci/jenkins#26668 * jenkinsci/jenkins#26600 * jenkinsci/jenkins#26587 * jenkinsci/jenkins#11216 * jenkinsci/jenkins#10432 * jenkinsci/jenkins#8559
Description
This PR parallelizes user index initialization during startup inside
hudson.model.User$AllUsers#scanAll.Benefits
ConcurrentHashMap(byName) for concurrent index registrations.Micro-benchmark Results (3,000 users, 10 iterations)
Fixes #27059
Testing done
I have added an automated test
parallelScanAllWithMalformedConfig()thatthat verifies the behavior of
User.AllUsers.scanAll().config.xmlfiles inside distinct directories:User.AllUsers.scanAll().finallyblock.Screenshots (UI changes only)
Before
After
Proposed changelog entries
parallelize user directory scanning and XML unmarshaling at startup
Proposed changelog category
/label major-rfe
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge: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.