Compiler threads

Volker Simonis volker.simonis at gmail.com
Sun Oct 13 17:48:40 UTC 2019


Hi Stefan,

the answer to your questions depends a little bit on the Java version
you are using.

In jdk8 you can use -XX:CICompilerCount=<n> to explicitly set the
number of compiler threads and  "-XX:+CICompilerCountPerCPU" to
automatically set the number of compiler threads to "1 compiler thread
for log(N CPUs)". If you use tiered compilation, which is the default,
the "AdvancedThresholdPolicy" compilation policy will be used (can be
controlled with "-XX:CompilationPolicyChoice=<n>"), which
automatically enables "CICompilerCountPerCPU" but sets the number of
compiler threads to log(N CPUs) * log(log(N CPUs)).

In general, the number of compiler threads when using tiered
compilation is distributed such that 1/3 of the total compiler threads
will be tier 1 (i.e. C1) compiler threads and 2/3 will be tier 2 (i.e.
C2) compiler threads.

With jdk11 this system has been reworked and made more dynamic by
introducing the option "-XX:+UseDynamicNumberOfCompilerThreads" which
is active by default. It will automatically spawn new compiler
threads, if the compilation queues get full (see
https://bugs.openjdk.java.net/browse/JDK-8198756 and
https://bugs.openjdk.java.net/browse/JDK-8201235 for a more detailed
explanation of the parameter).

Best regards,
Volker

On Sun, Oct 13, 2019 at 5:06 PM Stefan Reich
<stefan.reich.maker.of.eye at googlemail.com> wrote:
>
> Just a quick question: How many compiler threads does HotSpot use? Does it
> depend on then number of Java threads running?
>
> For example: Let's say I want the fastest startup time possible for a
> single-thread application, so I want parallel JIT compilation on, say, 7,
> out of 8 cores. Is that possible?
>
> Many greetings,
> Stefan
>
> --
> Stefan Reich
> BotCompany.de // Java-based operating systems


More information about the hotspot-dev mailing list