O'Reilly logo

Java Performance: The Definitive Guide by Scott Oaks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Summary of Tuning Flags

Table A-1. Flags to Tune the Just-in-Time Compiler
Flag What it doesWhen to use itSee also

-server

Chooses the server compiler

For long-running applications that need fast performance

Hotspot Compilation

-client

Chooses the client compiler

For applications where start-up is the most important factor

Hotspot Compilation

-XX:+TieredCompilation

Utilize tiered compilation (both client and server)

For applications where you want the best possible performance and have enough available native memory for the extra compiled code

Hotspot Compilation

-XX:ReservedCodeCacheSize=<MB>

Reserves space for code compiled by the JIT compiler

When you see a warning that you are out of code cache, and generally with when using tiered compilation.

Tuning the Code Cache

-XX:InitialCodeCacheSize=<MB>

Allocates the initial space for code compiled by the JIT compiler

If you need to pre-allocate the memory for the code cache, which is very uncommon.

Tuning the Code Cache

-XX:CompileThreshold=<N>

The number of times a method or loop is executed before compiling it.

When using the server compiler, can cause more methods to be compiled, and methods to be compiled sooner. The first case is sometimes an advantage if you aren’t using tiered compilation.

Compilation Thresholds

-XX:+PrintCompilation

Provide a log of operations by the JIT compiler.

When you suspect an important method isn’t being compiled, or are generally curious as to what the compiler is doing.

Inspecting the Compilation Process

-XX:+CICompilerCount=<N> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required