As you may have read from past articles, one of the key Java programmer skills to acquire is your ability to understand and assess the health of the JVM such as the Java heap memory footprint along with the garbage collection process.
In order to achieve the above goals, all JVM vendors (Oracle, IBM…) provide, via the verbose:gc parameter, a way to generate and log the runtime JVM & GC activity. That being said, this does not mean that you will have to analyze raw GC data forever. Monitoring and log analyzer tools have emerged over the past years allowing us to better “visualize” the complexity of the JVM runtime processing.
This article is the first of a series that provides you with a tutorial on how to get started and take advantage of the IBM Garbage Collection and Memory Visualizer. Future articles will cover in more detail the different GCMV features via examples and problem simulations.
If you are not familiar with the JVM principles and the different naming conventions, I first recommend that you go through the articles below. Improving your Java and JVM troubleshooting skills is like building a house: build a solid foundation and structure first before focussing on the finishing work.
- ## Sun HotSpot VM
- ## IBM VM
- ## Oracle JRockit VM
- ## Sun (Oracle) – Java memory management white paper
- ## OpenJDK – Open-source Java implementation
GC and Memory Visualizer – Tool overview
GCMV is essentially a free tool, developed by IBM, which allows you to “visualize” and analyse the JVM memory usage and garbage collection activity of your Java application(s). Its reporting and data visualisation features are extremely useful to understand the Java heap memory footprint trend of your application over time and can help detect problems such as memory leaks.
Such capabilities are achieved due to the tool’s ability to parse and interpret many types of GC logs (Oracle HotSpot, IBM JVM, native memory log etc.). Finally, GCMV also provides out-of-the-box recommendations via its internal statistical engine.
GCMV is best used in conjunction with a comprehensive capacity planning strategy so please continue to do your due diligence from that perspective.
The rest of the article will now focus on how getting started quickly with GCMV.
Step 1 – Download IBM Support Assistant
First, you will need to download and install IBM Support Assistant (GCMV is installed within the IBM Support Assistant Workbench).
Step 2 – Add GCMV as a new add-on
Once you have installed ISA, you will need to download GCMV as an ISA add-on as per the following steps:
- From the ISA main screen, select Launch Activity > Analyze Problem.
- Now select the link Find New Tools Add-ons.
- Expand JVM-based Tools, select and install IBM Monitoring and Diagnostics Tools for Java – Garbage Collection and Memory Visualizer for ISA.
- You should now see GCMV under the ISA Tools Catalog section.
Step 3 – Load and visualize your first JVM GC log sample
You are now ready to load and analyze your first GC log using GCMV!
- Under Tools Catalog, double click on GCMV.
- Now browse through your computer and select the desired GC log. The parsing and analysis process will now begin…
- Once the parsing process is completed, you will see a graphical view of the GC data along with many other options.
- The utilization of the different Java heap memory spaces can be found on the left side. The GCMV recommendations can be found under the graph via the Report tab.
* NOTE: instructions on how to obtain the verbose:gc logs from your JVM runtime environment can be found here.
I hope you enjoyed this short tutorial on how getting started with the IBM GCMV tool. The next article will cover in more detail a few classic JVM problem patterns such as memory leaks. In the meantime, I recommend that you load any GC log you may have from your application and start to get familiar with the different features of GCMV. Please feel free to comment or ask any question.Related Whitepaper:
Bulletproof Java Code: A Practical Strategy for Developing Functional, Reliable, and Secure Java Code
Use Java? If you do, you know that Java software can be used to drive application logic of Web services or Web applications. Perhaps you use it for desktop applications? Or, embedded devices? Whatever your use of Java code, functional errors are the enemy!
To combat this enemy, your team might already perform functional testing. Even so, you're taking significant risks if you have not yet implemented a comprehensive team-wide quality management strategy. Such a strategy alleviates reliability, security, and performance problems to ensure that your code is free of functionality errors.Read this article to learn about this simple four-step strategy that is proven to make Java code more reliable, more secure, and easier to maintain.