Sunday, July 29, 2018

Top 5 Java Performance Tuning Books for Experienced Programmers - Best of Lot, Must read

You might be thinking, why should a Java developer read a book on Performance tuning? When I first faced this question a long time back, I thought I will do it later, but I never got back to that for a long time. I realize my mistake of having a lack of knowledge on memory measurement, JVM tuning, and finding bottleneck only when I faced serious performance and scalability issues on our mission-critical, server-side financial application written in Java. It's true that when you really need it you learn most, but those times are not the best time to learn fundamentals, in fact, those times are to apply and correct your misunderstanding.

This is why I am sharing these Java performance books to all Java programmers and suggesting them to take some time and go through at least one book in full. By the way, these books are in addition to my 5 must-read books for Java programmers, which deals with all other topics in Java. If you haven't read them yet, make sure you check them as well.

Remember knowledge of Performance tuning is also one of the important aspects of experienced  Java developers and can separate you from the crowd. Ever since Java was introduced, almost 20 years back, it has faced criticism for being slow and lacking performance. Today, I don't think Java is anywhere behind in terms of performance to native languages like C or C++

Given Java's ability to natively compile hot code using JIT (Just in time Compiler), it is almost on par with native applications written in C and C++, but a lot can be done by following best practices, avoiding common performance pitfalls and using latest tools and techniques.

In this article, I am going to introduce with five + one (bonus) books on Java performance, which will not only teach you what to measure, how to measure but also explains fundamentals and concept behind those issues.

You will not only learn about the operating system and JVM on which your Java application run but also how to write faster coding using Java API. So what are we waiting for, let's begin our journey to a land of great books on Java performance tuning?



Top 5 Java Performance Books

Here is my list of some of the best books to learn the art of Java and JVM Performance tuning, to learn about JVM internals, Garbage collection tuning, JVM parameters, profiling and monitoring Java application and debugging it to find nasty bugs.


. In order to learn performance tuning, you should know the tools, process, options and most importantly avoiding common performance pitfalls. This book scores well on this point, it has a chapter introducing all the tools, a Java performance engineer should be aware of, including advanced tools like Flight Recorder and Java Mission Control.

It also has good chapters on explaining various garbage collection algorithms e.g. Concurrent Mark Sweep (CMS) and  G1 Garbage collector. 

You will learn how each of them works in different conditions, how to monitor them and how to tune them. It also includes a full chapter on heap analysis and optimization.

In short, This is one of the best books on Java Performance Tuning, but, If you like online courses, then you can combine this one with Pluralsight's Understanding the Java Virtual Machine: Memory Management course to get the best of both world.

Top 5 Java Performance Tuning Books - Best of Lot, Must read


This will teach you common things like how to take heap dumps and histograms in Java, and then introduces many ways to decrease your heap memory footprint.

It also has a chapter on JDBC and JPA performance. Key point it teaches you that how choosing the proper JDBC / JPA methods may far outweigh the gains from the SQL queries tuning.

Similarly, it has a complete chapter explaining about multi-threading issues, pitfalls and impact on performance. It includes advanced topics like ForkJoinPool and Java 8 Streams.

It also touches base on the cost of synchronization and false sharing, tuning JVM threads e.g. thread stack size, configure biased locking, thread priorities, and thread spinning.

By the way, best is yet to be introduced, what I like most about this book is Chapter 12. This chapter presents some classic core Java tuning tips and their impact. This includes buffered I/O, class loading, random number generation, JNI, exceptions, String performance, logging, Java Collections API, Java 8 lambdas vs anonymous classes and finally Java 8 stream and multiple filter performance.

This was actually the first chapter I read and I fall in love with its content and style. If you like to quickly gauge the book by yourself, I suggest starting with this chapter. It also touches base on Java EE performance, explaining possible issues with XML and JSON parsing, and object serialization.



This is one of the most up-to-date books on Java Performance tuning and writing code which execute faster in Java.  This was the book which told me that performance of Java application will be limited by three main factors CPU, Memory and IO (both Disk and Network), and surprisingly many developers who know how to use profiler doesn't know this basic fact.

best Java performance books for experienced programmers


Though this book also introduces many profiling tools I suggest latest books like  Java Performance The Definitive Guide By Scott Oaks and Java Performance By Binu John, Charlie Hunt has a more comprehensive list.




This was my favorite Java performance book from a long time, until recently when I read Java Performance The Definitive Guide By Scott Oaks. This book is very much similar to the one which replaced it from the top.

It has chapters explaining how to take measurements of performance, explaining tools necessary to measure CPU, Memory, and IO. Chapters on explaining How Garbage collection works, different GC algorithms e.g. Serial vs Parallel Garbage collectors, Concurrent Mark Sweep collectors etc.

Both, Binu John and Charlie Hunt have done an excellent job to how to construct experiments that identify opportunities for optimization, interpret the results, and take effective action.

Must read Java performance book

To give you some credibility and hint what you can expect in this book, Charlie Hunt is the JVM performance lead engineer at Oracle. He is responsible for improving the performance of the HotSpot JVM and Java SE class libraries. He has also been involved in improving the performance of the Oracle GlassFish and Oracle WebLogic Server.

While, Binu John is a senior performance engineer at Ning, Inc., where he focuses on improving the performance and scalability of the Ning platform to support millions of page views per month. Before that, he spent more than a decade working on Java-related performance issues at Sun Microsystems, where he served on Sun’s Enterprise Java Performance team.

If you haven't read any book on Java performance tuning and want to build a good foundation for dealing with performance problems, this is the book to buy. It's worth of every single penny spent.



Systems performance analysis is an important skill for all computer users, whether you're trying to understand why your laptop is slow or optimizing the performance of a large-scale production environment.

It is the study of both operating system (kernel) and application performance, and this book will tell you all you need to know about Linux performance monitoring and tuning. Programmer starts with optimizing algorithms, data structure, JVM, Garbage collectors but they eventually reach to a point where System performances come into play.

You may want to know why disk operations were so quick on your development box, but became a major issue on the production box, how CPU caching effect so much to your application, how can you leverage L1, L2, and L3 Cache, and Physical memory available on your machine.

Good Java Performance tuning  book

In my opinion, this is the book for every programmer and not just for Java programmer. Knowing how your system work, how paging, swapping and virtual memory work, how CPU gets data from disk,  how different kind of disk can make a profound impact on IO bound Java applications is very important for any developer genuinely interested in performance tuning.

I had often said, learn JVM but I can now say you must know your System well. Knowing operating system basics, system calls, memory, CPU, network and disk IO, caches will certainly go long way and helps you to write a high-performance application in any programming language, including Java.




Java Performance and Scalability: A Quantitative Approach by Henry H. Liu 
Before Introducing the book, let me introduce the author, he is a Ph.D., works at Vmware and specialized in writing high performance and scalable enterprise Java applications, but I think he is more known for his work on Software Performance and Scalability: A Quantitative Approach.

You can see this book a more specialized version of his earlier best seller.  As the name suggests this book is focused on performance and scalability of Java application.

This book is good for Java developers, architects, and even managers. It is divided into two main parts, the first part deals with the basics of Java performance and Scalability and second part presents practices to improve performance and scalability.

Java Performance book Garbage collection tuning

The basics part contains four chapters each of them separately explores scalability of software programs, computer hardware, and Java Virtual Machine. The second part contains chapters exploring how going from 32-bit to 64-bit affect performance and scalability of Java application.

Chapter 6 is probably the most important chapter which explains how to tune Java for best possible performance and scalability. It introduces methodologies, practices, tools and tuning Java application keeping scalability in mind.

Chapter 7 is another important chapter which explains how design, algorithms, and implementations affect performance and scalability of any Java application. It also covers how to perform a bottleneck analysis. The good thing is that he explains all this with sample programs, so you can follow guidelines while reading.

Overall its a very good and unique book for Java performance engineer, and if you love to read multiple books to gain insights, this is the one you can read along with  Java Performance The Definitive Guide and  System Performance: Enterprise and the Cloud.



This is the bonus book for my readers, I won't say this book only focuses on Java performance tuning but I would say this is the book every modern Java developer should have on his shelf. Ben Evans and Martijn Verburg don't need any introduction.

They are well known Java experts and founder of jClarity, which promises to solve performance problems in cloud environments. They have many years of experience in Java, which reflects in their book The Well-Grounded Java Developer: Vital techniques of Java 7 and polyglot programming.

good book for modern Java developers

This is the must-have book for modern day Java developer. It explains new changes on Java including those in JDK 7 e.g. try-with-resources, NIO2.0, and concurrency changes; but most importantly It explains why it is so expensive to add new features to the JVM.

Adding new library extensions such as fork/join or syntactic sugar like switch-on-string is relatively easy, but adding a JVM instruction like invokedynamic is very costly.

Probably the best thing about this book is that it doesn't stop at Java, and go one step further to introduce modern-day JVM language e.g. Scala, Clojure, and Groovy.

It touches functional programming with new JVM languages and modern approaches to test, build and contentious integration of Java applications.


That's all on this list of good Java performance tuning books. I have recommended Effective Java a lot of time and as one must have book for Java developers, but same time I have also found that you should have a book dedicated to Java Performance Tuning.

After some years of work and experience in Java, you are bound to face performance challenges, and at this time, you should, at least, know fundamental, tools and process of finding the bottleneck and improving the performance of Java application.

So, if you haven't read any Java performance book, this is the time to read one.

Further Learning
Java Memory Management
Understanding the Java Virtual Machine: Memory Management
10 All-time great books for Java Programmers
10 Books Java Developers Should Read in 2018
10 Algorithm Books Every Programmer Should Read
5 Spring Framework Books Experienced Dev Should Read
10 Things Java Developer Should Learn in 2018
10 Tips to become a better Java Programmer

Thanks for reading this article so far. If you like these Java Performance books then please share with your friends and colleagues. If you have any questions or feedback then please drop a note.


4 comments :

Anonymous said...

Sir,Gud noon
I wanna ask one thing or suggeation from you.
I want to be an Oracle cert. developer in java tech.
How to study in java,i mean how much deeply undrstand the concept? or anything else you want to suggest me plz
Thank you

Anonymous said...

Do you suggest any tutorial or training class to learn tricks on Java performance improvement?

Vlad Mihalcea said...

"High-Performance Java Persistence": https://leanpub.com/high-performance-java-persistence/ is also about tuning the data access layer, so it's worth checking it out too.

Anonymous said...

Here is another list of 10 free Java Programming books, worth checking it out too. Cheers ...

Post a Comment