This is a review of the book Java EE 7 Performance Tuning and Optimization
What is this book about?
As the title clearly suggests, this book deals with Performance Tuning. It focuses on tuning, monitoring and optimizing the performance of Java EE applications in particular.
It starts off with basics of Performance Tuning and gives us an insight into the various kinds of performance related issues which one might face in the context of enterprise grade, distributed web (Java EE) applications. The book provides a quick fire tour of Java EE 7, familiarizes the reader with the basics of JVM (memory model, garbage collection. concurrency) and dives into the nitty-gritty of Performance Testing in Java.
The author guides us through some common performance issues and their symptoms along with a detailed insight of Java monitoring and profiling tools (in the JDK, IDEs etc). Topics like CPU, Memory and Thread Profiling have dedicated chapters and have been covered in great detail. The book delves into the topics of Tuning a Java EE application and its various facets (JVM, App Server, Web Server, the OS) along with a primer on Designing High performance Java EE applications. Last but not the least, the reader can dig into some Performance Tuning Tips (EJB, JPA, Servlets, JSF, Java SE) and apply the knowledge gained from the book in tuning a sample Java EE application hands-on!
Who has written this book?
The book has been authored by Osama Oransa. More about him here
What does the book cover?
The book is well organized and divided into twelve chapters. Let’s take a peek and see what each one has to offer.
Chapter 1 – Getting Started With Performance Tuning
This chapter introduces us to the world of Java EE performance tuning.
- Classifies different types of performance related issues based on phases of discovery.
- It goes on to differentiate typical application modes (standalone, thick and thin) along with a brief summary
- Provides a quick peek into the all the components/layers of web applications and their properties which are critical from a performance standpoint – from the client end right down to the DB server
All in all, this lesson does a great job of getting things rolling and setting up the reader for what’s coming next. This is of great value for someone who is relatively new to the concept of Performance tuning and monitoring and allows her to get a decent head start.
Chapter 2 – Understanding Java Fundamentals
It lays a strong emphasis on strengthening the fundamentals associated with the Java Platform which are directly related to performance. Two primary topics which are covered are the JVM fundamentals and Java EE 7 (yes!)
- Discussion of the JVM memory structure (as laid out by the JVM specification) and details around the Java HotSpot VM.
- Exploration of the JVM Garbage Collector and its policies
- Provides a brief overview of Java EE 7 – its specifications and features
- Delves into some of the concurrency constructs available in Java EE – Async invocations, Singleton beans, non blocking I/O etc
Chapter 3- Getting Familiar with Performance Testing
Chapters 1 and 2 provided a good foundation and this chapter builds upon it. It deals with Performance Testing on a whole
- It explores different facets of performance testing like types, components, tools, benchmarking etc along with an explanation of common testing terminologies and a discussion around performance testing in a Cloud environment.
- The rest of the chapter deals with Apache JMeter and thoroughly covers web service, web application and database scripts with the help of succinct examples.
Chapter 4 – Monitoring Java Applications
This chapter deals with in depth coverage of the tools associated with performance monitoring and profiling in depth.
- Starts off with an overview of the JDK monitoring and profiling tools landscape
- It delves into details of these tools – memory map and heap analysis tools, JVisual VM and Oracle Java Mission Control
- The NetBeans and Eclipse are covered as a part of the section which deals with IDE capabilities for JVM monitoring and profiling.
- The chapter ends with a tour of JProfiler with a focus on the offline profiling mode.
Chapter 5 – Recognizing Common Performance Issues
This chapter builds on the performance issues overview provided in Chapter 1. It brings into focus, some of the frequently occurring performance issues and briefly looks at each of them
- Explores Threading and deadlock related issues
- Discusses performance issues which can be attributed to to memory (leakage), improper use of remote calls, database performance etc
Chapter 6 – CPU Time Profiling
This chapter deals takes up one of the key aspects in Java profiling – CPU Time profiling
- Discusses three profilers – NetBeans native profiler, the Java Mission Control and JProfiler
- Explains how to interpret and make sense of the results obtained from the profiler tools
- Delves into pin pointing and identification of performance issues (algorithm related, caching, threading etc) and provides a recipe/strategy for fixing them.
Chapter 7 – Thread Profiling
The deep dive into Java profiling continues. This time, the focus is one Thread profiling and its related nuances
- As was the case with CPU Time profiling, the thread profiling options are explored with the help of NetBeans, Java Mission Control as well as JProfiler
- Explains how to extract thread dumps with the help of JDK, application server and various profiler tools
- Deals with interpretation of thread profiling results and analyzing thread dumps
- Deep dive into exploration of threading related issues such as deadlock, blocked threads, unmanaged threads etc and builds on the recipe for fixing such issues (from the previous lesson)
Chapter 8 – Memory Profiling
This chapter marks the last section of the in-depth coverage of the types of profiling and deals with the all important area of memory profiling
- How to use the NetBeans profiler and the JProfiler for memory profiling
- Explains the process of heap dump extraction using a variety of tools such as jmap, JVisual VM, Eclipse MAT, JProfiler etc
- Guides us through the process of heap dump analysis using visual tools as well as via he OQL (Object Query Language)
- Analyses the potential issues emerging from memory related roots
Chapter 9 – Tuning an Application’s Environment
After all the discussion and exploration about potential performance related issues, related profiling tools and possible remediation, the focus now shifts to Tuning. This chapter deals with application environment tuning is specific which is divided into distinct categories
- Detailed exploration of JVM tuning including both HotSpot and JRockit
- Deep dive into application server tuning with GlassFish and Oracle Weblogic being the prime examples. Talks about tuning components such as EJB and Web containers, JDBC pools, thread pools etc
- Exploration of HTTP server tuning with the help of Apache and Oracle HTTP server
- Discusses tuning and optimization of operating system and hardware (capacity planning) related components
Chapter 10 – Designing High-performance Enterprise Applications
As the name clearly suggests, the chapter looks at the design aspects of enterprise applications. After having discussed different facets of performance tuning/monitoring/profiling, it makes sense to try and understand how to put certain best practices to practical use.
- Explores different set of design decisions (app layer, security, framework etc) and their probable impact and introduces some common anti-patterns as well
- Provides good insight/analysis of SOA and ROA based architectures and their performance aspects
- Discusses the impact of data caching on performance in details and looks at topics like concurrency, data caching levels, how to assess caching performance etc
- The chapter ends with an absorbing discussion on performance considerations from a Cloud deployment perspective
Chapter 11 – Performance Tuning Tips
This lesson provides general performance tuning tips, tricks and recipes for a variety of scenarios and use cases related to Java EE as well as SE
- Deals with Java EE component specific performance secrets – EJB, JSF, JPA, web services etc
- Explores general performance related topics from the Java SE space – I/O, Collections framework, synchronization etc and also peeks into the javap tool available in the JDK
- The chapter ends with a discussion aobut database related performance tips ranging from choice of ORM library to executing bulk uploads in an optimized manner.
Chapter 12 – Tuning a Sample Application
This lesson is all about getting our hands dirty and applying the concepts learnt in the book in order to tune a real-world application
- Introduces the sample application, and sets up an assessment plan
- Guides us through the profiling process using previously described techniques such as CPU Time, memory profile etc
- Deep dive into analysis of performance issues detected by the profiling process and resolution of each of those issues
- Coverage of the testing process to assert performance improvements post issue resolutions
Performance Tuning is not an easy topic to discuss or write a book about. Although it is based upon reasoning and science, more often than not, it is triggered due to unprecedented scenarios.
- The author covers a vast landscape in general – from depths of the Java Platform basics, JVM to app server tuning, Databases and straight on to the Cloud !
- In general, the book is applicable to wide variety of audience, but the day-to-day/ traditional Java developers stand to reap maximum benefit out of this book
- The sample application tuning exercise is a great addition to the book. Again, performance tuning is not an easy thing to discuss and convey and setting up a application for hands on practice needs is indeed priceless
- Leverages sample code, examples and pictorial representations in an effective manner.
Note: While most of the aspects of the book are great, but there are certain areas in the book where the grammar and overall English could have been better. Personally, it did not prove to be a hindrance for me, but can be improved.
Where can you grab the book?
A book this versatile and multi-faceted should not be missed – especially when it deals with Performance Tuning !
Visit the PacktPub web site to get your copy!!
Happy Reading 🙂