Affects Version/s: None
Fix Version/s: None
I've been using this in my own gradle.properties (both for test and gradle vms).
I think otherwise there may be a bad multiplicative effect at play: if you have N (say 16 cores), the build defaults to using 8 parallel resources. But each of these jvms uses ergonomic defaults to size stuff like compiler/gc threads according to the entire machine. Similar to the reasons behind container support, etc.
I tell each build/test JVM to pretend like it runs on 1 cpu machine with this flag. It seems to give a lower load average when running tests? Something to look into.
Overrides the number of CPUs that the VM will use to calculate
the size of thread pools it will use for various operations such
as Garbage Collection and ForkJoinPool.
The VM normally determines the number of available processors
from the operating system. This flag can be useful for parti‐
tioning CPU resources when running multiple Java processes in
docker containers. This flag is honored even if UseContainer‐
Support is not enabled. See -XX:-UseContainerSupport for a de‐
scription of enabling and disabling container support.
cc Dawid Weiss