the Java API, in this case they will be treated similarly. This topic covers both facets of the
The performance of the JVM is based largely on tuning flags, while the performance of the
platform is determined more by using best practices within your application code. In an en-
vironment where developers code and a performance group tests, these are often considered
separate areas of expertise: only performance engineers can tune the JVM to eke out every
last bit of performance, and only developers worry about whether their code is written well.
That is not a useful distinction—anyone who works with Java should be equally adept at un-
derstanding how code behaves in the JVM and what kinds of tuning is likely to help its per-
formance. Knowledge of the complete sphere is what will give your work the patina of art.
A Brief Outline
First things first, though: Chapter 2 discusses general methodologies for testing Java applica-
tions, including pitfalls of Java benchmarking. Since performance analysis requires visibility
into what the application is doing, Chapter 3 provides an overview of some of the tools avail-
able to monitor Java applications.
Then it is time to dive into performance, focusing first on common tuning aspects: just-in-
ing chapters focus on best practice uses of various parts of the Java platform: memory use
some general Java SE API tips ( Chapter 12 ).
Appendix A lists all the tuning flags discussed in this topic, with cross-references to the
chapter where they are examined.
Platforms and Conventions
This topic is based on the Oracle HotSpot Java Virtual Machine and the Java Platform,
Standard Edition (Java SE), versions 7 and 8. Within versions, Oracle provides update re-
leases periodically. For the most part, update releases provide only bug fixes; they never
provide new language features or changes to key functionality. However, update releases do
sometimes change the default value of tuning flags. Oracle will doubtless provide update re-
leases that postdate publication of this topic, which is current as of Java 7 update 40 and Java