Core Java

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

Why Java developer should read a book on Performance tuning? When I first faced this question long time back, I thought I will do it later, but I never get back to that for a long time. I realize my mistake of having lack of knowledge on performance measurement, 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 sometime 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. Remember knowledge of Performance tuning is one important aspect of Senior Java developers, and can separate you from crowd. Ever since Java was introduced, almost 20 years back, it has faced criticism on being slow and lacking performance. Today, I don’t think Java is anywhere behind in terms of performance to native languages. Given Java’s ability to natively compile hot code using JIT (Just in time Compiler), it is almost at 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 good 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 System and JVM on which your Java application run but also how to to writer faster coding using Java API. So what are we waiting for, let’s begin our journey to land of great books on Java performance tuning.

  1. Java Performance The Definitive Guide By Scott Oaks
  2. Java_performance_the_definite_guide_StockIn one word, this is currently THE best book on Java Performance tuning. Multiple reasons for that, one of them is, this is the most updated book, covers up-to Java 7 update 40. In order to learn performance tuning, you should know tools, process, options and most importantly avoiding common performance pitfalls. This book scores good on this point, it has chapter introducing all the tools, a Java performance engineer should be aware of, including the one which is added in Java 7u40, e.g. 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 include a full chapter on heap analysis and optimization. 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 touch base on 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 I like most in 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 is actually the fist 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 touch base on Java EE performance, explaining possible issues with XML and JSON parsing, and object serialization.

  3. Java Performance By Binu John, Charlie Hunt
  4. Java PerformanceThis was my favourite Java performance book from long time, until recently when I read Java Performance The Definitive Guide By Scott Oaks. This book is very much similar like the one which replaced it from top. It has chapters explaining on 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. Binu John and Charlie Hunt has done excellent job to how to construct experiments that identify opportunities for optimization, interpret the results, and take effective action. 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 and 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 on dealing with performance problems, this is the book to buy. It’s worth of every single penny spent.

  5. System Performance : Enterprise and the Cloud By Brendan Gregg
  6. System Performance Enterprise and the CloudSystems 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 comes 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 affect so much to your application, how can you leverage L1, L2 and L3 Cache, and Physical memory available in your machine. 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 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 goes long way and helps you to write high performance application in any programming language, including Java.

  7. Java Performance Tuning by Jack Shirazi
  8. Java Performance TuningThis is one of the premier book on Java Performance tuning and writing code which execute faster in Java. When Jack first wrote this book, there was hardly anything available. Even Second edition of this book is almost 11 years old, released around 2003. Why would I recommend you something which has written 11 years back? because it contains some advices, practices and techniques which is timeless and worth knowing even today. Though you can not follow this book on its original spirit and you should always keep in mind that most of the things mentioned in this book is already addressed in subsequent Java releases. The best advice is in chapter 1 itself, 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 knows how to use profiler doesn’t know this basic fact. It’s classical advice “Don’t Tune What You Don’t Need to Tune” is the best performance advice, I have ever read. You can take a look at Performance Check-list given in this book to get an understanding of what matters and what not. Though this book also introduce many profiling tools but I suggest latest books like  Java Performance The Definitive Guide By Scott Oaks and Java Performance By Binu John, Charlie Hunt has more up-to date list. You should remember that this book does not cover only up to JDK 1.4.0. but you should check chapters 4 – 12, which cover various performance tips and techniques you can apply to Java code. Jack also has a site http://www.javaperformancetuning.com/, which is great resource to learn performance tuning for Java developers.

  9. Java Performance and Scalability: A Quantitative Approach by Henry H. Liu
  10. Java Performance Scalability Quantitative approachBefore Introducing the book, let me introduce the author, he is a PHD, 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 name suggest this books is focused on performance and scalability of Java application. This book is good for Java developers, architects and even managers. It is divided in two main parts, first part deals with basics of Java performance and Scalability and second part presents practices to improve performance and scalability. The basics part contains four chapters each of them separately explores scalability of software programs, computer hardware, and Java Virtual Machine. 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 affects performance and scalability of any Java application. It also covers how to perform bottleneck analysis. 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.

  11. The Well-Grounded Java Developer
  12. The Well Grounded Java DeveloperThis 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 in his shelf. Ben Evans and Martjin Verburg doesn’t need any introduction. They are well known Java experts and founder of jClarity, which promises to solves 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. I first come across this books on 2012, and after reading sample chapters, I was convinced to buy this book. 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 bottleneck and improving performance of Java application. So, if you haven’t read any Java performance book, this is the time to read one.

Javin Paul

I have been working in Java, FIX Tutorial and Tibco RV messaging technology from past 7 years. I am interested in writing and meeting people, reading and learning about new subjects.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
MA Subhan
MA Subhan
10 years ago

Appreciate your effort in writing this. This is truly helpful.

Regards
MA Subhan
http://www.upskilltechnologies.com

Back to top button