If you are working on WebSphere then most of the time during project phase, you need to spend troubleshooting and tweaking application performance. Most of the time for performance-related issue, you will work with a developer, and you will be asked to take the heap dump for analysis. There are various ways to take a heap dump. If you are wondering how to take in WebSphere, then this guide will help you. Once you have the heap dump, you need to analyze, and unfortunately, you can’t open that in notepad, so you got to use the tools. But don’t worry following tools will help you to read the heap dump file for analysis. They are all FREE!
IBM HeapAnalyzer
HeapAnalyzer by IBM helps you to find the possible Java heap leak area, and you can download from here.
Once downloaded the jar file, you can run them like below.
It will open the Analyzer. To open the heap dump, Go to File » Option and select the heap dump. Based on file size, it may take few seconds and then give you summary view.
The quickest way to suspect for any leak would be:
Go to Analysis menu » Analysis view
If no leak found then, it will display something like this.
So go ahead and try out the various options under “Analysis” to get familiar with the tool.
Eclipse Memory Analyzer (MAT)
MAT analyze heap dump with hundreds of millions of objects, and it’s fast. Quickly check the suspected leaks and run excellent graphical reports in a minute. MAT by default doesn’t support WebSphere generated heap dump, so you need to use the plugins. You can download the MAT from here and plugins from here. Installation of plugins is simple. Just copy the plugin jar file to MAT plugins folder.
Once downloaded MAT, you can open by executing
To analyze heap dump file, Go to File » Open Heap Dump and select the file It will take few seconds and prompt “Getting Started Wizard.”
You can select whatever you want and click on Finish. Ah, it found two leak suspects.
MAT is very powerful and can analyze some metrics. Ex:
Top consumers by biggest objects Biggest top-level dominator classes Biggest top-level dominator packages Threads overview Heap Dumps overview
If you are using another J2EE application server, then you may use VisualVM to analyze the heap dump. You may also be interested in learning about Java memory management.