Gradle multi-project parallel build consumes 100% of CPU time
Asked Answered
A

1

5

System info
enter image description here

Software info
OS:
enter image description here
Java: OpenJDK 12.0.2
Gradle: 5.6.2

The issue Building Gradle multi-project with parallel builds enabled consumes almost all the CPU time. PC is not interactable during the build process

Steps to reproduce
1. git clone --recursive https://github.com/vividus-framework/vividus.git
2. cd vividus
3. ./gradlew build

Adnopoz answered 23/10, 2019 at 13:53 Comment(2)
You get what you have ordered. Where is the problem? You want that the build gets done as fast as possible and the consequence is that all resources are consumed.Invigilate
Hi Peter, thanks for your input :) Same set of setting on Unix-like, for example, macOS does not become not interactable. The question here how I can free some resources for Windows without changing the building approach; Once again thank you for the answer!Adnopoz
W
6

In your gradle.properties file (or GRADLE_OPTS environment variable), try setting org.gradle.priority=low. On my machine it has a noticeable effect with parallel enabled, but I've also heard from some of my co-workers with older machines that this setting didn't help them too much.

You can also experiment with setting org.gradle.workers.max. It defaults to the number of CPU processors. Maybe set it to the number of logical processors minus one.

If it still stops you from interacting with your computer during the build, you should probably just disable parallel execution and let Gradle work on a single processor.

Wordy answered 23/10, 2019 at 14:30 Comment(2)
Thank you Bjorn, will try and report resultsAdnopoz
An example of what to fill into the GRADLE_OPTS environment variable: -Dorg.gradle.workers.max=10 (i.e. one is actually setting JVM option(s) there).Tedmund

© 2022 - 2024 — McMap. All rights reserved.