Skip to content

Speed up multibranch pipelines by processing events in parallel - #827

Open
Nezz wants to merge 1 commit into
jenkinsci:masterfrom
Nezz:parallel-events
Open

Nezz wants to merge 1 commit into
jenkinsci:masterfrom
Nezz:parallel-events

Conversation

@Nezz

@Nezz Nezz commented Sep 3, 2026 •

Copy link
Copy Markdown

We have a single monorepo with over 50 multibranch pipelines. We noticed that when a webhook is received (e.g. PR opened, new commit pushed) the multibranch PR projects get updated sequentially, taking 3-4 seconds per pipeline. This means that the last pipeline starts running with several minutes of delay.

This was caused by the SCM event listener applying each event to every matching project one at a time. Applying an event means a blocking SCMSource.fetch call: a round trip to the SCM (GitHub in our case).

This change keeps the cheap part (working out which projects match the event) serial, but runs the per-project fetches concurrently on a shared thread pool. The pool defaults to 10 threads, matching the SCMEvent dispatcher pool.

With this change, all of our pipelines start running within seconds.

Related issue: #797 but it describes the same sequential stuff happening in OrganizationFolders

Testing done

Added a test asserting that one event matching 3 projects is applied to all of them concurrently. It fails with the previous sequential setup, or when the pool size is forced to 1.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@Nezz
Nezz requested a review from a team as a code owner September 3, 2026 15:29
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.

3 participants