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 severe 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 essential 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.

1.Java Performance The Definitive Guide By Scott Oaks - Best book to learn JVM internals

. 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 excellent 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 everyday 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. The critical 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 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 excellent 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.

2.Java Performance Companion by Charlie Hunt

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 that told me that the 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 don't know this basic fact.

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

And, If you need a course, you can also combine this book with the Java Memory Management  course on Udemy.

best Java performance books for experienced programmers

3.Java Performance By Binu John - Good book to learn Java Performance

This was my favorite Java performance book for 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, demonstrating tools necessary to measure CPU, Memory, and IO. Chapters on explaining How Garbage collection works, different GC algorithms like Serial vs. Parallel Garbage collectors, Concurrent Mark Sweep collectors, etc.

Both Binu John and Charlie Hunt have done an excellent job on 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 every single penny spent.

4.System Performance: Enterprise and the Cloud By Brendan Gregg

Systems performance analysis is an essential 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 Systems (kernel) and application performance, and this book will tell you all you need to know about Linux performance monitoring and tuning. The programmer starts with optimizing algorithms, data structure, JVM, Garbage collectors, but they eventually reach 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 significant 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 programmers. 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 significant for any developer is genuinely interested in performance tuning.

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

5. 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 bestseller.  As the name suggests, this book is focused on the performance and Scalability of Java application.

This book is suitable 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 the 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 the Scalability of software programs, computer hardware, and Java Virtual Machine. The second part includes chapters exploring how going from 32-bit to 64-bit affects the performance and Scalability of Java application.

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

Chapter 7 is another essential chapter that explains how design, algorithms, and implementations affect the 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 an excellent 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 withJava Performance The Definitive Guide andSystem Performance: Enterprise and the Cloud.

6.The Well-Grounded Java Developer - the Best book for Modern Java Developer

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 founders 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 developers. It explains new changes in Java, including those in JDK 7 like 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 languages likeScala, 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 times, and as one must-have a book for Java developers, but the same time I have also found that you should have a publication 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

The 2020 Java Developer RoadMap

Top 5 Courses to Learn Microservices in Java with Spring

10 All-time great books for Java Programmers

10 Books Java Developers Should Read in 2020

10 Algorithm Books Every Programmer Should Read

5 Spring Framework Books Experienced Dev Should Read

10 Things Java Developer Should Learn in 2020

10 Tips to become a better Java Programmer

Top 5 Courses to learn JVM Internals and GC in Java

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