vendredi 5 avril 2019

What is limiting number of active workers in a Gradle build?

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 hw.physicalcpu
hw.physicalcpu: 4

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 reserverd for the build itself), which coincides with the number of physical CPUs.

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.

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.

Aucun commentaire:

Enregistrer un commentaire