I am trying to run tests in parallel on my laptop, which has 4 pyhsical and 8 logical CPUs.
➜ sysctl -n hw.ncpu
8
➜ sysctl -n hw.physicalcpu
4
I would like to run at most 4 tests in parallel.
This is the command that I am running:
./gradlew remoteChromeTest -Pparallel=4 --continue --max-workers=8
The parallel
property goes into maxParallelForks
of the Test
task.
Still, Gradle only seems to occupy at most 4 workers concurrently (one of which seems to be reserved for the build itself), which coincides with the number of physical CPUs (not sure if that matters).
The output looks like this:
> Task :remoteChromeTest
Running tests in parallel using 4 processes.
<============-> 92% EXECUTING [12s]
> :remoteChromeTest > 0 tests completed
> :remoteChromeTest > Executing test spec.Spec1
> IDLE
> :remoteChromeTest > Executing test spec.Spec2
> :remoteChromeTest > Executing test spec.Spec3
So, only 3 tests are running in parallel.
What am I missing here? The documentation suggests this could be cranked up beyond the number of actual CPUs. The weird part is that one of the workers shows up as IDLE
.
I am getting the same behaviour on another machine, which has only 2 physical cores, and there it is limited to two processes, i.e. no parallel execution at all.
Why is one worker IDLE
?
IDLE
. My question is: what is causing theIDLE
worker? – Ce