Skip to content
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

chore: Parallelize Tests #739

Merged
merged 1 commit into from
Jul 16, 2023
Merged

Conversation

rahulsom
Copy link
Contributor

This will use all available cores to run tests, and parallelize by all - suite/class/method. On machines with multiple cores, this will vastly improve test performance. These times are on my M1 MBP with 10 (8P + 2E) cores. They were reported by maven on running mvn verify.

I first ran mvn verify and ignored the time.
Then I ran it thrice without this change, and thrice with this change.

All times in seconds.

Run 1 Run 2 Run 3 Average
Before 304 306 307 306
After 120 123 118 120
Savings 186
% 61

Your checklist for this pull request

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

This will use all available cores to run tests, and parallelize by all - suite/class/method.
On machines with multiple cores, this will vastly improve test performance.
These times are on my M1 MBP with 10 (8P + 2E) cores. They were reported by maven on running `mvn verify`.

I first ran `mvn verify` and ignored the time.
Then I ran it thrice without this change, and thrice with this change.

All times in seconds.

|        | Run 1 | Run 2 | Run 3 | Average |
| ------ | ----: | ----: | ----: | ------: |
| Before |   304 |   306 |   307 |     306 |
| After  |   120 |   123 |   118 |     120 |
| Savings|       |       |       |     186 |
| %      |       |       |       |      61 |
@lifeofguenter
Copy link
Contributor

Oh wow, very cool - thanks @rahulsom !

@lifeofguenter lifeofguenter merged commit a1c9812 into jenkinsci:master Jul 16, 2023
15 checks passed
@jtnord
Copy link
Member

jtnord commented Jul 17, 2023

this hard codes the values which are not suitable for all environments - the values can previously be opt into this when it is run.

For example on a 3 year old laptop with and i7-10875H this will use 16 threads and surefire is set to use 756MB per fork so 12GB can be needed with this change.

this can be performed locally already with mvn -DforkCount=1c when running, and actually removes the ability to set a forkCOunt for the environment (e.g. if you have large CPU count but not the associated memory)

@lifeofguenter
Copy link
Contributor

@jtnord thanks for the comment.

This can be removed once buildPlugin has support for this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants