Monday, July 6, 2009

2009 JavaOne: VisualVM


I have been excited about the inclusion of VisualVM with Sun's HotSpot since its bundling with Java SE 6 Update 7. VisualVM combines the best of several other Sun-provided Java tools such as the visual tool JConsole and command line tools such as jinfo, jmap, jstat, and jstack. VisualVM can also be downloaded separately from Sun's Java SE 6 implementation from

VisualVM at 2009 JavaOne

I have spoken with many experienced Java developers who have been unaware of the existence of VisualVM. I also found it interesting that in the recent VisualVM blogging contest, VisualVM was described as "the best kept secret" in Java development. Besides holding the blogging contest related to VisualVM, other measures have been taken to make sure that the secret is out. In this blog post, I will focus on two presentations from 2009 JavaOne that go a long way toward getting the word out about the existence and benefits of VisualVM: "Monitoring and Troubleshooting Java Platform Applications with JDK Software" (BOF-4724) and "Hop on Board the Java Troubleshooting Platform" (TS-4247).

Monitoring and Troubleshooting Java Platform Applications with JDK Software

The Birds of a Feather session "Monitoring and Troubleshooting Java Platform Applications with JDK Software" was led by Mandy Chung and Tomas Hurka. Each of these Sun employees possesses the credentials to conduct such a BOF session.

Mandy Chung has worked with JConsole and various Java management related APIs. Her blog post Java SE 6 Monitoring, Management, Diagnosability may be the best online starting point for learning about Java SE 6 management, monitoring, and diagnostics. That particular blog post lists Java SE 6's many features and tools with a concise description of each and links to additional resources on that feature. Chung is also the author of Monitoring and Managing Java SE 6 Platform Applications and a contributor to the Troubleshooting Guide for Java SE 6 with HotSpotVM.

Tomas Hurka presented a BOF at 2008 JavaOne that introduced VisualVM and was called "VisualVM: Integrated and Extensible Troubleshooting Tool for the Java Platform" (BOF-5223). Perhaps most importantly in terms of credentials, Hurka is the lead developer on the VisualVM project.

The BOF presentation only has 17 slides (probably due to demonstrations and discussion), but these are 17 content-packed slides. One of my favorite slides in this presentation is the third slide of the presentation. It is called "Monitoring and Troubleshooting Tools" and contains a table that maps a management/monitoring/troubleshooting feature to a Sun-provided command-line (CLI) tool and to the relevant graphical (GUI) tool. Many articles and blog posts and even the VisualVM home page talk about VisualVM being a composite of the various command-line tools. The table of this slide does the best job I have seen of tying command-line tools to VisualVM and associating VisualVM with the specific troubleshooting feature provided by the command-line tool.

The majority of the presentation focuses on providing additional details and usage information regarding the command line tools and graphical tools mapped on the slide just mentioned. In particular, focus is placed on JConsole, VisualVM, diagnosing deadlocks, diagnosing memory leaks, diagnosing hot lock contention, diagnosing OutOfMemoryError, diagnosing a hung process on Linux or Solaris (Windows support planned), and diagnosing a few other negative conditions.

Hop on Board the Java Troubleshooting Platform

A Sun employee and member of the NetBeans Team, Geertjan Wielenga focuses in this presentation specifically on VisualVM. Wielenga may be best known to many developers for his DZone/JavaLobby articles on NetBeans and VisualVM. The presentation can be roughly described as made up of two major pieces. The first half is devoted to introductory and overview information on using VisualVM and the second half is dedicated to extending VisualVM.

These slides provide a useful introduction to VisualVM, what it is, and why and how one might use it. The slides also show how and why VisualVM can be extended. Two of my favorite slides in this presentation appear toward the end. The slide called "The Future" focuses on potential improvements to VisualVM such as OSGi support and the possibility of more plug-ins for VisualVM. The "References" slide provides links to several useful resources on VisualVM. There is a relatively large amount of demonstration code included with the slides that helps understand lower level details.


The two presentations briefly reviewed here contribute to getting the word out about VisualVM. I have blogged on VisualVM several times and cannot say enough good things about the tool.

Additional Resources

VisualVM Project Page

JavaLobby VisualVM Tagged Articles

The Best Kept Secret in the JDK: VisualVM

VisualVM: Free and Open Source Java Troubleshooter

Java VisualVM Tech Notes

Thread Analysis with VisualVM

Heap Dump and Analysis with VisualVM

Acquiring JVM Runtime Information

VisualVM: jinfo and So Much More

From JConsole to VisualVM