Skip to Content
Java Performance: The Definitive Guide
book

Java Performance: The Definitive Guide

by Scott Oaks
April 2014
Intermediate to advanced content levelIntermediate to advanced
423 pages
12h 24m
English
O'Reilly Media, Inc.
Content preview from Java Performance: The Definitive Guide

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.

Hot Spot Compilation

-client

Chooses the client compiler.

For applications where startup is the most important factor.

Hot Spot Compilation

-XX:+TieredCompilation

Uses 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.

Hot Spot 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 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 preallocate the memory for the code cache, which is very uncommon.

Tuning the Code Cache

-XX:CompileThreshold=<N>

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

When using the server compiler, this 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

Provides 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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 8 in Action

Java 8 in Action

Mario Fusco, Alan Mycroft, Raoul-Gabriel Urma
Java Concurrency in Practice

Java Concurrency in Practice

Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea
Java Memory Management

Java Memory Management

Maaike van Putten, Dr. Seán Kennedy

Publisher Resources

ISBN: 9781449363512Errata Page