I have been fortunate to attend Kirk Pepperdine’s Java Performance Tuning course on the beautiful Mediterranean island Crete.
My journey started on 11 September 2011 at London Gatwick. With a flight delayed for 90 minutes I arrived late on Sunday evening. I met up with Kirk Pepperdine in the lobby of the Perle Spa Hotel, which was quite something. The views from the balcony were panoramic.
The course took place at Heinz Kabutz’s place, where he and his family have a great home and a fully air conditioned training room for up to eight people, which extended from a balcony. It is pretty cool to see. Heinz is also a Java Champion and author of the popular Java Specialists newsletter.
Picture of moi taken by Henri at Irene’s place in Crete. I was wearing Kirk’s sunglasses, and actually, he was wearing my Pradas.
The goal of the course was to teach the students, like me, learn how to quickly find and identify the root causes of poor performance. On the first day of the course, we discussed what is the meaning of performance? We looked into the causes of poor performances. Since all of the students on the course were Java software engineers or system integration or consultants, then we knew the technology. We knew that Java exhibited multiple personalities, a language, a run time and eco-system. We also knew of some tooling or some way examine the functions of technology, fire up an IDE, start a debugger, compile a Java program, build software. What we did not have before day one of this course was an investigative policy or how to form one?
Attendees find the course to be a relearning of everything they thought they knew about performance tuning
Day one was best described as Kirk Pepperdine, sharing his methodology, of how to think about performance? I found the analogy personally that I came up with, privately, to be particularly useful. I thought about how would one learn to become a police detective. How does a new lay person go about solving a crime, like a kidnapping, a robbery, or an horrendous murder? The answer is a decent detective, a person who going to great at such a profession, have a career trade in it, is going to look at the entire swathe of evidence, and asked themself, what is this particular evidence telling me about the crime that took place. There are no secret fast tricks to solving a million pound bank robbery and the same applies to when the performance of your system takes nose dive, does not meet your expectations.
The view from the Perle-Spa Hotel in Crete
To be successfully tuning systems, not applications, over and over, we need discipline. Kirk Pepperdine discussed the obvious (or may not so obvious) view that performant code needs simpler code. He mentioned components are better, because a component can be swapped out (or in). Small method were better, so was loosely coupled software architecture. If you write software mostly following the SOLID principles, in my opinion, you are on a good path.
Writing good quality software, which has more than 50% code coverage in Cobertura, produces great Maven aggregated report, and continuously delivered by Jenkins (or Hudson) is all well and good. However, have you thought about your threading model before your implemented the application?
Naturally you cannot ever hope to be a good investigator with the basics of forensics. With performance tuning in Java (or any other system), Kirk Pepperdine, pushed us to understand measurement. In order to work out where, when, who, what, and why, on the first day, we looked at the system model. The parts of the system include the operating system, the JVM, the application and the users of the application. Kirk also talked to us about various timers that are working and those that are not working. We also got into logging frameworks.
On the second day, the course, we build more on Kirk’s process, we started on benchmarking. How do we benchmark correctly? Why is writing a micro benchmark so hard and long? In particular we had a really great exercise on the Apache JMeter tool, which I understand 100% better.
Actually, the second day was rather long, because we covered a surprising amount of material. We also benefited from stretching our minds with exercises. From benchmarking we went on to looking at HotSpot JVM and the interesting configuration parameters. Kirk Pepperdine also showed and explained the generations of garbage collection and the memory management of the JVM. We had several exercises and project labs to do. Finally, we look into monitoring and reading GC verbose logs. The course work certainly help to impress the discipline of performance tuning. Whilst the concepts were mostly new to my ears, I felt I was stepping up to the new challenge with greater confidence.
View at night
What do I think of Java Performance Tuning? I had two fabulous days of learning. I feel that I understand a better philosophy, a certain direction, and methodology that structures the art and hints and tips of making Java go fast. I have two more days to go.
When you first pick up a musical instrument, an electric lead guitar from a Rose Morris shop in town, which you never did before. You say to yourself, I am going to learn how to play. You also should believe that as soon you start learning how to play that you are a guitarist now.