“Java Performance : The Definitive Guide” by Scott Oaks will soon hit the book shelves through Oreilly. Our resident Java Guru Jason Koch (LinkedIn) brings you a sneak preview of what the book has to offer. Jason Koch is a Java Performance Architect with 6 years technical delivery experience spent working across various organization functions that include support, technology, architecture including application design and development.
I had the opportunity recently to review an early release edition of Java Performance: The Definitive Guide, put together by Scott Oaks, who is introdcued as having been a part of the Java Performance Group at Sun Microsystems and Oracle for at least 15 years. The book targets experienced Java developers who have a need or interest in making their software run a little faster. The focus is mostly on tuning the application after it has been put together, as opposed to early architecture or tuning decisions. Of course, being an early release, only a few chapters were available at the time of review so more content is likely to come available. This makes the book suitable primarily for somewhat experienced developers who are new to performance tuning. Given the nature of the book, it should also be somewhat accessible material for a sysadmin who needs to understand how to tune a Java application, possibly with the support of a developer.
As mentioned, the book has a focus on tuning applications as they’ve been put together, and is an excellent primer to some of the things that have a big impact on Java performance. For example, monitoring and tuning the JIT compiler, and monitoring and tuning the different garbage collection algorithms are provided. For each of the content areas there were a number of examples provided.
The book opens with coverage on toolkits – benchmarking and profiling. It was good to see Scott mention the challenges of benchmarking – in fact he spent a whole chapter covering a slice of the challenges with micro benchmarking before getting started. This is brilliant to see; in fact it would be nice to see mention of JMH which is a relative newcomer to the microbenchmark world. I was a little concerned with some of the phrasing early on; hopefully this will be cleared in reviews – I’ll come back to this shortly. The coverage on profilers was useful though could benefit, for a developer brand new to performance testing, how to use one of these tools or some pointers on what to look for.
Following the introductory sections on benchmarking, in the next two chapters Scott drills down into JIT compilation and Garbage Collection. The presentation here is clear and detailed and with some good examples to follow it through based on the x86 platform. Scott does a great job of explaining the tradeoffs involved in each of the tuning settings. It was interesting to see benchmarks of Tiered Compilation, as I’ve not yet had the opportunity to play with this, so this will probably make its way onto my tuning checklist. He also includes some coverage of Java Flight Recorder. The extra detail on adaptive sizing is a nice level of detail that many other articles don’t explain – Scott explains the tradeoffs and where you would consider adaptive sizing clearly. I look forward to seeing if the additional to-come chapters are presented with this level of detail.
My one gripe with the content so far, which was partially cleared up later in the text, was in the chapter on toolkit. I think the wording used here is very dangerous to provide to someone getting started. Early on in the chapter, Scott makes the statement: “The goal in performance is to drive CPU usage as high as possible for as short a time as possible.”, followed by shortly by “The CPU number is an indication of how effectively the program is using the CPU, and so the higher the number the better.”. He does some work to clarify, but I would really encourage some care when reading this section of the book.
The main topics include:
- An Approach to Performance Testing
- Java Performance Toolbox
- Working with the JIT Compiler
- Garbage Collection
Overall, as an early release book with only a few chapters, I found the content clear and instructive. The book will be most helpful for a developer or possibly a system administrator who is new to performance on the JVM, and who wants to learn the dials that control performance. I look forward to the full edition, as it’s already a useful book even with only a few chapters complete.
Jason Koch (LinkedIn) is a Java Performance Architect with 6 years technical delivery experience spent working across various organization functions that include support, technology, architecture including application design and development. Jason was recently inspired by Martin Thompson’s ideas of Mechanical Sympathy and over the last couple of years he has begun focusing on engineering systems for performance. Jason is also constantly encouraging design & development teams to consider performance proactively at the architecture & design phase as compared to viewing performance as purely a post development, testing and tuning effort.