This is the fifth article in the series of articles exploring the tools and techniques for analyzing, monitoring, and improving the performance of Java applications.
The Art of Java Application Performance Analysis and Tuning-Part 1 The Art of Java Application Performance Analysis and Tuning-Part 2 The Art of Java Application Performance Analysis and Tuning-Part 3 The Art of Java Application Performance Analysis and Tuning-Part 4
In this blog we will continue to look at some of the useful tools for analyzing the Java application programs.
IBM Health Center
Some of the discussed tools (Jmap ) works for Oracle Hot Spot VM only.
The IBM Monitoring and Diagnostic Tools for Java – Health Center is a tool from IBM which enables you to assess the current status of a running Java application on IBM Java VM. This is very good low-overhead diagnostic tool and API for monitoring an application running on an IBM Java Virtual Machine. This works very well even in high heap memory usage applications.
Using IBM Health Center we can
- Identify if native or heap memory is leaking
- Discover which methods are taking most time to run
- Visualize and tune garbage collection
- View any lock contentions
- Monitor your applications Thread activity
- Detect deadlock conditions in your application
- Gather class histogram data (Equivalent to jmap -histo:live)
The Health Center tool is provided in two parts:
The Health Center client: is a GUI-based diagnostics tool for monitoring the status of a running Java Virtual Machine (JVM), installed within the IBM Support Assistant (ISA) Workbench.
The Health Center agent: provides the mechanism by which the Health Center client obtains information about your Java application. The agent uses a small amount of processor time and memory and must be manually installed in an IBM JVM.
Fig G. shows an overview of where the Health Center client and agent are located, when installed in ISA and the JVM.
Steps to install/use Health Center:
- Step 1 – Install the Health Center client:
- Step 2 – Launch the Health Center client:
- Step 3- Enable your application for monitoring:
- Step 4 -Connect Health Center to the enabled Java application:
Above steps are explained in
Configuring and Connecting Java Application
Installing the Health Center agent: Most of the IBM Java Runtime Environments (JREs) already have a Health Center agent installed. If installed the “jre/lib” folder contains healthcenter.properties file.
If agent is not installed then install the agent by following instructions from below link.
Configure and start the Health Center agent: You can start the Java application with enabling health center agent by adding the -Xhealthcenter:port=1965,level=headless property to java command line.
More detailed options at:
Install the Health Center client: : Follow the below link to installation
Launch Health Center Client:
- Start the ISA Workbench (From Windows Programs menu)
- From the Welcome page, click Analyze Problem.
- On the “Analyze Problem” tab, select Tools option
- You will be presented with a list of all the installed tools. Select “IBM Monitoring and Diagnostic Tools for Java – Health Center” and then click on Launch.(Fig H.).
- The Health Center application will now launch and the Health Center: Connection wizard will be displayed.
Important note: Your application must be enabled for monitoring before Health Center can be connected.
Connecting to a Java application using the Health Center client: Select New Connection from the File menu of an Health Center client.
A connection wizard is displayed (Fig I.). Ensure that you have enabled your application for monitoring then click Next. Specify the host name and port number. The Health Center makes a connection using these details.
More Details at:
ISM Health Center Options
Once you have connected Health Center to an application, Health Center Client is composed of following options (Fig. J)
- Classes: Displays information about classes loaded and class histogram.
- Garbage Collection:: Displays information about Garbage Collection and memory use.
- I/O: Displays information about application I/O Activity.
- Profiling:: Displays information about application method profiling.
- Threads: Displays information about the Java application threads
- Native Memory: Displays information about the Native Memory of Java application
- Others:There are other useful options like Locking , I/O, Environment etc..
Monitoring Method Profiling
Method profiling (Fig K.) can be used diagnose applications showing high CPU usage. It shows where the application is spending its time, by giving full call stack information for all sampled methods.
By identifying the hot methods/mostly called methods, we can optimize the methods/application logic to improve the performance.
Monitoring Garbage Collection and Memory
The Memory tab (Fig L.) provides information about memory consumption and Garbage Collection. This can be used to analyze OutOfMemory (or) max resource usage scenarios.
Monitoring Class Loading
The Classes tab (Fig. M) displays information about class loading. This gives the number of classes loaded in the system.
The “Class histogram data” button option is the simple way to get the live object instances in the heap memory. This is equivalent to jmap -histo:live option.
This gives the histogram of class names with number of instances and no. of bytes. This will be useful in OutOfMemomy and high memory usage situations. Using this histogram we can identify which class has more number of instances and size.
We can get this output at regular intervals and can analyze to identify objects which are growing.
Monitoring Thread Information
The Threads option (Fig N.) provides information about thread use. It gives the number of threads running in the application. We can get the “stack trace” of a particular thread by clicking the thread name on left side panel.
If the number of threads increasing continuously then we can suspect the thread leak.
Monitoring Native Memory Usage
We can monitor the Native Memory by using “Native Memory” option [Fig O.] Native Memory is the memory used by the Java application other than heap memory. This memory contains the Thread Memory/Stack Size, Direct memory allocations (-XX:MaxDirectMemorySize=1G ) etc.. This is useful for analyzing the thread leak and native memory leaks..
Monitoring Application I/O Activity
I/O Option [Fig. P] gives the I/O activity of the application.
More Details at: