Top 5 books to learn Java Virtual Machine, Garbage Collection, and Performance in-depth

In the last couple of years, I have seen a trend of many Java developers wants to learn more and more about JVM internals and how Java Virtual Machine and it's different component works. This trend was not so strong in the last decade, but with more and more focus on concurrency, performance, and scalability, Java developer is exploring JVM internals, Garbage collection, and Performance tuning in more detail. Unfortunately, there are not many good books to learn about JVM internals and its different components but fortunately, we have an excellent Java Virtual Machine specification to learn fundamentals. It is also the most up-to-date reference because Java and JVM are kept changing, especially after Java 10.

Once you know the fundamentals you can easily apply the more advanced concepts. I receive a lot of emails about the recommendation of best books to learn JVM internals and garbage collections form experienced Java programmers and hence I decided to write about this post to share some of the best books on JVM internals.

The books in this list are solely for advanced Java developer who has at least 4 to 6 years of Java working experience under their belt. It's not for beginners and most likely lot of concept will go top of your head unless you understand key components like JIT, Garbage collector, Java heap structure, byte codes, and other JVM internals.

Btw, if you prefer online courses, which I do nowadays, I also suggest you check the Understanding the Java Virtual Machine series of courses on Pluralsight, which covers memory management, Security, and Class Loading and Reflection.




Top 5 Books to learn JVM Internals and Performance

Without wasting any more of your time, here is my list of some fo the best books to learn JVM internals, Garbage Collection, and Performance tuning in Java. Though you don't need to read all the books to become an expert in JVM internals, you choose the one book along with the specification and stick with it. Once you have good knowledge you can check other books to learn more about them.


1. Optimizing Java
The Optimizing Java: Practical Techniques for Improving JVM Application Performance 1st Edition
by Benjamin J Evans, James Gough, and Chris Newland is one of the best books to understand how Garbage collection and JVM works internally. I originally missed this book in the list because I haven't read it until Ben suggested in the comments, but just reading a couple of pages, I was convinced that this book deserves a mention in this list.

Many books focus mainly on GC, but this one describes many more aspects of JVM internals like threading, JVM internal memory representation, bytecode, JIT compilers, etc. Moreover, the book contains an overview of many useful tools which can help you on a daily basis work with JVM.

This book is also much more approachable in this list than some specialized book like The Garbage collection handbook, which is great for people who want to learn GC algorithms in-depth but may not be needed for most of the developers.

Best books to learn JVM and JIT in depth





2. The Java Virtual Machine Specification, Java SE 12 Edition
This the most authoritative source to learn about a new Java virtual machine comes as part of the JDK 12 release. So it includes lambda expression, method reference, static factory method, string in switch case and other language enhancements made in the Java SE 12 release and previous releases.

In my opinion, The Java Virtual Machine Specification, Java SE 12 Edition by Tim Lindholm, Frank Yellin, Gilad Bracha, and Alex Buckley is the best book to learn JVM internals but its not very readable.

When I first tried to read this specification, I was overwhelmed with the depth of the knowledge and wording, but slowly I picked it up. I don't read it end-to-end but rather use as reference material when I need to learn a particular topic.

No doubt it's an excellent reference and must-read guide for JVM internals by any Senior Java developers, and I accept the readability issue with the complexity of subject matter unless we have a proper JVM internal books aimed to average Java developers. Though, if you want to learn more about JVM memory stuff then Java Memory Management course on Udemy is also an excellent resource.








3. Java Performance The Definitive Guide By Scott Oaks
This is the book I recommend to average Java programmer to learn about JVM internals. It's not as detailed and sophisticated as the above two books, but it contains enough detail on both Java Virtual Machine and Garbage collector, which I believe every experienced Java programmer should know.

The Java Performance The Definitive Guide By Scott Oaks is undoubtedly the best book to learn JVM internals for many Java programmers who are keen to learn fundamentals of JVM and how different components of JVM works. A must-read book for every experienced Java programmers.




4. The Garbage Collection Handbook 
One of the exciting parts of the Java Virtual machine is automatic memory management, which is done by Garbage collector. The Garbage collection is a very complicated process and involves a sophisticated algorithm to collect unreachable objects without affecting the performance of Java application negatively.

The Garbage Collection Handbook: The Art of Automatic Memory Management (Chapman & Hall/CRC Applied Algorithms and Data Structures series) is one of the best books to understand Garbage collection algorithms in a systematic and practical way.

If you are senior Java developer with a focus on GC tuning and performance improvement, then this is the must-read book for you.




5. Java Performance by Charlie Hunt
This is another book I used to recommend to my readers and students before I come across Java Performance The Definitive Guide By Scott Oaks, but it holds its ground even after that book claimed a lot of market share on Java performance topic.

Both Binu John and Charlie Hunt are the authority on JVM options and Java Performance space, and they teach essential JVM internals information in much more readable way than you find in The Java Virtual Machine Specification, Java SE 8 Edition book.

The only drawback is that it's not up-to-date, but once you know the fundamentals, you can easily upgrade yourself with more recent concepts and development by reading these specifications and articles.




6. Java Performance Companion
This is like the updated version of the previous book o learn about JVM internals and performance tuning. Again author Charlie Hunt teamed with Monica Beckwith, Poonam Parhar, and Bengt Rutisson to teach you how to improve performance of Java application. This is the most up-to-date book but only covers until Java SE 8, which is not bad given most of the Java applications are still using Java SE 8.



That's all about some of the best books to learn JVM internals. These are great books to understand both theory and practical about how a Java virtual machine works, How garbage collector works and how Just in time compiler optimize the performance of Java programs. As a senior Java developer its also expected from you to know Java in and out and with an increased focus on JVM internals, GC tuning, and performance improvement, it would be imperative for an experienced Java developer to learn more and more about JVM and Garbage collector.


Other Java and Programming articles you may like

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

P.S. - If you like to learn from courses then you can also check out this list of best courses to learn JVM and Garbage collection better. The list contains some of the best books on the topic of JVM internals and performance tuning.

2 comments:

  1. I'll admit to being a little disappointed not to see my book "Optimizing Java" on this list. I'd like to think that we were a little more accessible (& useful in day-to-day work) than, for example, the Garbage Collection Handbook, which is an excellent book for GC implementors but not very applicable to the vast majority of Java application programmers.

    ReplyDelete
    Replies
    1. Hello Ben, definitely, Optimizing Java deserved a mention in this list. It's indeed more approachable for Java developers than GC algorithm book. I'll add this book into list now.

      Delete