Appendix. Summary of Tuning Flags

This appendix covers commonly used flags and gives pointers on when to use them. Commonly used here includes flags that were commonly used in previous versions of Java and are no longer recommended; documentation and tips on older versions of Java may recommend those flags, so they are mentioned here.

Table A-1. Flags to tune the just-in-time compiler
Flag What it does When to use it See also

-server

This flag no longer has any effect; it is silently ignored.

N/A

“Tiered Compilation”

-client

This flag no longer has any effect; it is silently ignored.

N/A

“Tiered Compilation”

-XX:+TieredCompilation

Uses tiered compilation.

Always, unless you are severely constrained for memory.

“Tiered Compilation” and “Tiered Compilation Trade-offs”

-XX:ReservedCodeCacheSize=<MB>

Reserves space for code compiled by the JIT compiler.

When running a large program and you see a warning that you are out of code cache.

“Tuning the Code Cache”

-XX:InitialCodeCacheSize=<MB>

Allocates the initial space for code compiled by the JIT compiler.

If you need to preallocate the memory for the code cache (which is uncommon).

“Tuning the Code Cache”

-XX:CompileThreshold=<N>

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

This flag is no longer recommended.

“Compilation Thresholds”

-XX:+PrintCompilation

Provides a log of operations by the JIT compiler.

When you suspect an important method isn’t being compiled or are generally curious ...

Get Java Performance, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.