By Jiri Sedlacek on Jul 26, 2010
The new version of the VisualVM tool is now available at https://visualvm.dev.java.net. VisualVM 1.3 introduces several new features and improvements, extends the API for plugins and fixes many bugs. Details of the changes can be found in the Release Notes. Let's look at the most interesting new features in more detail:
Sampler In The Core Tool
The sampling profiler that was originally provided as a plugin has now been integrated into the core tool. Sampler provides a lightweight and safe way to determine performance bottlenecks and memory problems and adds minimal overhead to the target application. It can be used for local and remote applications running on JVMs from different vendors and is designed to be used in production environments. Once a problem is identified, it can be further analyzed in detail using the instrumenting Profiler with appropriate settings (profiling roots, instrumentation filter). Profiler is available for local applications running on an Oracle/Sun-compatible JDK and is mostly intended as a profiling tool for Java developers.
Sampler And Profiler Presets
All the Sampler and Profiler settings can now be saved into presets and reused for further application/VisualVM sessions. This makes it much easier for developers to analyze and improve applications using the iterative profile-fix-restart approach. Moreover, a preset can be selected automatically for an application based on its main class or display name.
Remote Heap Dumps
In previous releases, the VisualVM was only able to take heap dumps of applications that were running locally. The only way to dump the heap of a remote application was by using the MBeans plugin and invoking the appropriate MBean operation (com.sun.management.HotSpotDiagnostic | Operations | dumpHeap). Starting with VisualVM 1.3, you can now use the Heap Dump actions and buttons in the tool to take a heap dump of applications that are running remotely. When invoked, a dialog is displayed that enables you to specify the full path on the remote system where you want to dump the heap. After the heap dump is created, you need to manually copy the file to your local machine and use the Load action to open and analyze the file using VisualVM.
Monitoring Remote Hosts
In every release of VisualVM it is possible to open the Local system node in the Applications view and see the machine setup (OS, architecture, number of processors etc.), actual CPU load (not available for Windows OS) and physical & swap memory usage. VisualVM 1.3 enables you to obtain this information for remote hosts as well if the host has at least one JMX-enabled application defined in VisualVM. The data is obtained using the application's JMX connection. If the "proxy" application finishes, the live data will freeze and will be updated again when another JMX-enabled application becomes available on that host.
Sorting Hosts, Applications, Coredumps And Snapshots
By default, all nodes are sorted by the insertion time. This means that the last discovered application is added to the end of the list of running applications. In VisualVM 1.3 you can newly sort applications also according to their display name or process ID, which simplifies monitoring systems that are running many Java applications. The other nodes can now be sorted either by the insertion time or by display name.
Tracer Framework And Probes
Tracer is a new framework and GUI for monitoring and analyzing Java applications. Using various types of probes, Tracer gathers metrics from an application and displays the data in a timeline. This gives a quick overview of what is happening in various parts of the application and allows you to easily determine the relations between the metrics. The values are displayed both graphically and in a table and can be exported to common formats for further processing with external tools. VisualVM 1.3 comes with several sets of Tracer probes that are distributed as plugins: Monitor Probes, JVM Probes, Jvmstat Probes, Swing Probes, JavaFX probes and DTrace Probes.
Threads Inspector Plugin
The Threads Inspector integrates with the Threads tab and allows you to analyze the stack trace(s) of one or more selected threads directly without requiring you to take and open full thread dumps. This is extremely useful when you need to quickly analyze various threading problems.
Recognizing Alternative JVM Languages
Some developers use VisualVM as a monitoring and profiling tool for alternative JVM languages that do not have dedicated tooling. VisualVM now recognizes the Clojure, Groovy, JRuby, Jython and Scala runtimes, enabling these developers to easily find the appropriate processes.
Built On NetBeans Platform 6.9
VisualVM 1.3 uses the most recent NetBeans Platform and profiler release to ensure the best performance and greatest stability. The HeapWalker now displays local variables in the Threads section of the Summary | Overview view, providing a better context for the state of the heap at the time the heap dump is created.
VisualVM 1.3 is available for download at https://visualvm.dev.java.net. You can send your comments to the VisualVM developers by using the feedback mailing list. The API documentation can be found here.