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.
Top 5 Java Performance Books
1. Java Performance The Definitive Guide By Scott Oaks
In 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.
2. Java Performance By Binu John, Charlie Hunt

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

4. Java Performance Tuning by Jack Shirazi

5. Java Performance and Scalability: A Quantitative Approach by Henry H. Liu

6. The Well-Grounded 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 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.
Tidak ada komentar:
Posting Komentar