Question

I would like to know if my no VM argument invocation of HotSpot Java is running with -client, -server, or tiered compilation options. When I supply no VM arguments, which one is chosen by default? Is there a way to output diagnostics about which JIT compiler is running?

Was it helpful?

Solution

Assuming this is Hotspot:

-XshowSettings:vm

For example, on my Windows box I get output of:

VM settings:
    Max. Heap Size (Estimated): 1.77G
    Ergonomics Machine Class: client
    Using VM: Java HotSpot(TM) 64-Bit Server VM

OTHER TIPS

From the program that is run, you could query the java.vm.name property to differentiate between client and server mode. On hotspot it will contain "Server" if you have used that option (for example: Java HotSpot(TM) 64-Bit Server VM).

According to this page:

Tiered compilation is now the default mode for the server VM.

Note: it works now but is probably not the most future-proof approach.

Slightly better method of determining which JIT compiler is in use.

On a Windows machine with 32-bit JDK8:

    $ java -version
    java version "1.8.0"
    Java(TM) SE Runtime Environment (build 1.8.0-b132)
    Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)

    $ java -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot Client Compiler

    $ java -server -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot Tiered Compilers

So the Client Compiler is the default with the Windows 32-bit JDK8 and the '-server' option gets you the 32-bit Tiered Compiler.

On a Windows machine with 64-bit JDK8:

    $ java -version
    java version "1.8.0"
    Java(TM) SE Runtime Environment (build 1.8.0-b132)
    Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

    $ java -XshowSettings -version 2>&1 | grep sun.management.compiler
        sun.management.compiler = HotSpot 64-Bit Tiered Compilers

So the Tiered Compiler is the default with the Windows 64-bit JDK8. Oracle does not provide a 64-bit Client VM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top