Good evening Community, Is there a way with IDEA C...
# community-support
j
Good evening Community, Is there a way with IDEA CE to 1. limit the number of daemon workers that are spawned, 2. specify the jvm options to be used (I don't want the
-XX:+HeapDumpOnOutOfMemoryError
for example) and 3. specify jvm args for the Kotlin daemon?
Copy code
\_ /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=...
           \_ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -XX:+HeapDumpOnOutOfMemoryError --add-exports=jdk.compiler/com.sun.tools.javac...
           \_ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -XX:+HeapDumpOnOutOfMemoryError --add-exports=jdk.compiler/com.sun.tools.javac...
           \_ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -XX:+HeapDumpOnOutOfMemoryError --add-exports=jdk.compiler/com.sun.tools.javac...
           \_ /usr/lib/jvm/java-11-openjdk-amd64/bin/java -cp /...
adding some details: • JVM settings from
gradle.properties
(project root) are correctly applied to the daemon (excepted the
gradle.user.home
system property but that's another story) •
org.gradle.parallel
is not set • maybe I have missed some system properties for the gradle and kotlin workers?
l
You can use
org.gradle.jvmargs
and
kotlin.daemon.jvmargs
for jvm options
example
gradle.properties
file:
Copy code
org.gradle.jvmargs=-Xmx5g -XX:MaxMetaspaceSize=1g -Dsun.java2d.debugfonts=true
kotlin.daemon.jvmargs=-Xmx16g
j
thanks @Laura Kassovic for the
kotlin.daemon.jvmargs
I missed that one for the gradle workers I found out that they were spawned by the use of
options.fork = true
(see there) and that's also the project that set the JVM args used for these one remaining issue it that IDEA CE starts the main daemon with
maxWorkerCount=4
and I can't find where this is configurable, if this is configurable...
v
org.gradle.workers.max
controls the max workers: https://docs.gradle.org/current/userguide/build_environment.html
j
thanks, but the issue I have is that the Gradle Daemon gets the value 4 through
StartParameters
(same as command line args) and that takes precedence over values set through properties files, I have the same issue with
gradle.user.home
v
Did you try to use that property? I'd highly doubt IntelliJ sets those explicitly, but probably the tooling API reads the values to give it to the daemon. If I for example set the environment variable
GRADLE_USER_HOME
it is considered also from IntelliJ execution while a startparameter would take precedence.
j
ok it was worth trying it worked actually:
maxWorkerCount=1
must have been some default value set by the daemon at startup, a bit surprising with
parallelProjectExecution=false
all that time thanks
v
parallel has nothing to do with workers, those are completely separate things
parallel means that tasks from different projects can run in parallel if they don't have a dependency or ordering constraint
max workers controls how many worker processes get started at max
And the default for max workers depends on your amount of processors
j
yes that's not quite what it means with other tools (or intuitively) as the project will still (apparently at least) run compilation tasks in parallel even though
org.gradle.parallel
is not set, and there is also some parallelism going on to some degree within a single daemon (several worker threads) ... but ok, they added parallels to their parallels
v
Maybe it was intended to control more or whatever. The description is quite clear about it. Besides that I guess that option will sooner or later be removed anyway. Using configuration cache is much better and allows all tasks, even those within one project, to run in parallel.
j
mmh maybe that's what happened then, I still have:
Copy code
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
but reading the description it's not clear that it enables anything else than storing/loading from cache in parallel
v
The second is only for loading and storing the CC in parallel, yes.
But using the CC per-se enables at execution time all tasks to run in parallel if they don't have an ordering constraint or dependency