Skip to content

Build: Allow overriding the default test parallelism of 1 #13675

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mxm
Copy link
Contributor

@mxm mxm commented Jul 25, 2025

This adds the testParallelism property which allows to set the number of Gradle workers for test tasks. The default remains 1 worker (no concurrency).

I found myself frequently editing the test section of the Flink build files to speed up the build. This PR allows everyone in Iceberg to selectively increase the test parallelism.

Why?

While the build tasks run in parallel, there is no concurrency on the individual build tasks. By far, tests take the longest time to execute. Running them in parallel yields a speedup of at least 2. Locally, speedups of 3 are possible. In CI, the speedup is also above 2. See the test results below.

How?

Set the number of test workers to a fixed number:

./gradlew :iceberg-flink:iceberg-flink-2.0:check -PtestParallelism=5

Enable auto-mode, which sets the test parallelism to availableCPUs / 2:

./gradlew :iceberg-flink:iceberg-flink-2.0:check -PtestParallelism=auto

Test results

Local

On my machine (MacBook Pro M1 Max):

parallelism run time
1 32m 19s
5 (auto) 9m 47s
8 9m 1s
10 10m 39s

Note:

  • M1 Max has 10 cores (8 performance cores, 2 efficiency cores).
  • While a test parallelism of 8 is optimal, the value of auto mode (5) performs reasonably well.

GitHub CI

In this PR, I enabled the flag to run Flink tests. I don't know how many cores we have available in CI, so I tested only with the status quo (testParallelism=1) and the auto-mode set to numCpus and numCpus/2 (the latter is what I propose as the default for the auto mode).

parallelism run time test run
1 41m 37s link
numCpus / 2 (auto) 20m 13s link
numCpus 17m 9s link

In CI, using all available CPUs performed better than using only half. Nevertheless, I would prefer to use the more conservative value of numCpus / 2 for the auto mode. This still gives a speedup of more than 2.

This adds the `testParallelism` property which allows to set the number of
Gradle workers for test tasks. The default remains 1 worker (no concurrency).

I found myself frequently editing the `test` section of the Flink builds to
speed up the build. The speedup is linear to the number of workers used, given
that the machine can keep up.

Example:
```
./gradlew :iceberg-flink:iceberg-flink-2.0:check -PtestParallelism=8
```

Initially, I was planning to add this only to the Flink build files, but I think
all other modules of Iceberg can benefit from this build setting.
@github-actions github-actions bot added the build label Jul 25, 2025
@jkolash
Copy link
Contributor

jkolash commented Jul 30, 2025

I had been manually editing this as well.

@github-actions github-actions bot added the INFRA label Aug 1, 2025
@mxm mxm force-pushed the test-parallelism branch 2 times, most recently from a45fbfb to f2f3c33 Compare August 1, 2025 14:20
@mxm mxm force-pushed the test-parallelism branch from f2f3c33 to 0e1a3e9 Compare August 1, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants