VisualVM 1.2 Adds Powerful New Performance and Memory Profiler
VisualVM 1.2 has just been released and is available for download at https://visualvm.dev.java.net! After eight months of development, this release introduces many new features and improvements, including a new sampling profiler (read further for details), redesigned charts, unmatched jstatd support and customizable proxy settings. A complete list of changes is available in the Release Notes.

Monitor view showing new graphs
Let's take a look at the most important feature in more detail: the VisualVM-Sampler plugin which is available from the Plugins Center. The plugin provides the tool with a powerful performance and memory profiler which uses sampling, a technique that allows performance and memory data to be gathered with zero setup and virtually no overhead. By periodically polling the monitored application for thread dumps or memory histograms, the profiler helps in locating potential bottlenecks or memory leaks while still allowing the application to run at full speed.
During CPU profiling, the tool gets thread dumps from the monitored application by a customizable sampling rate and displays the results the same way as the built-in instrumenting Profiler. Live tabular data showing Hot Spot methods enable you to immediately detect a bottleneck in the application. You can then save the collected data into a standard .nps snapshot that provides additional Call Tree and Combined views for detailed inspection. The profiler obtains the thread dumps using a JMX connection which means that any JMX-enabled application (JDK 5+ from various vendors) can be profiled both locally and remotely. You can even profile several applications at once. From now you can use VisualVM to profile almost any Java application no matter if it's a locally running Sun JDK application or a remote IBM JDK-powered application server!

CPU sampler showing live results

CPU snapshot created by the Sampler
When profiling memory, the tool reads application memory histograms using the Attach API and displays live tabular data for both Heap and PermGen memory spaces. Using the Deltas mode you can easily watch newly allocated and disposed objects over a specific period of time or while an action is executed which makes it really easy to identify a memory leak. Also, the memory data can be saved as a .nps snapshot which can later be compared to other memory snapshots using the Compare function. Once the memory leak is identified, you can investigate the leak further by using the built-in HeapWalker. The HeapWalker has been enhanced to support displaying retained sizes and provides a powerful OQL scripting engine.

Memory sampler showing live objects deltas

Memory sampler showing live PermGen histogram
The new VisualVM-Sampler plugin doesn't replace the built-in instrumentation Profiler. In fact, it fills a gap in the optimal profiling workflow. If there is a performance problem and you don't know which part of the application is misbehaving, you can now use the Sampler to quickly identify the bottleneck. Once identified, you can setup the instrumentation Profiler to inspect the affected code, and get exact call trees and invocation numbers while imposing the lowest possible overhead on the application. In future releases of VisualVM, these two tools will be merged into a single powerful Profiler that combines all the advantages of sampling and instrumentation.
VisualVM 1.2 is free and open source, which makes it a good choice for all Java developers who care about the performance and memory management of their applications. Go and download VisualVM 1.2 from https://visualvm.dev.java.net to try it yourself!
- Login or register to post comments
- 9656 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)















Comments
William Louth replied on Wed, 2009/10/21 - 5:08pm
Jiri Sedlacek replied on Thu, 2009/10/22 - 1:29am
in response to: wl88194
Hi William, it's nice to see you here, welcome! I'm glad you've spent your time by comparing VisualVM to JXInsight again, it's a great message for our users that a free and opensource tool can be compared to such a complex and pretty expensive enterprise system!
I've noticed that you are using VisualVM for some time already, there are several screenshots from the VisualVM-MBeans plugin published on your pages. Does it mean we can mention your company as one of prominent users of VisualVM? Great!
William Louth replied on Thu, 2009/10/22 - 2:59am
in response to: jiri.sedlacek
Jiri Sedlacek replied on Thu, 2009/10/22 - 3:15am
in response to: wl88194
William Louth replied on Thu, 2009/10/22 - 6:40am
in response to: jiri.sedlacek
Robert Enyedi replied on Thu, 2009/10/22 - 4:50am
Great job! VisualVM is a hidden gem of the JDK and I've use it several times to profile CPU and memory of troublesome medium sized Web applications. Looking forward to see the improvements in this area. I don't really understand the discussion from the above thread: VisualVM is an easy to use entry-level monitoring and profiler tool which leaves plenty of space for commercial tools, better suited for large enterprise applications. One day VisualVM might beat them all, but not today.
That being said, monitoring of remote applications through SSH was something that I never managed to do with VisualVM. I've seen this problem discussed on several forums, but I have found no working solution. Does this version offer improvements in this area?
Jiri Sedlacek replied on Thu, 2009/10/22 - 5:51am
in response to: sky_HALud
William Louth replied on Thu, 2009/10/22 - 8:00am
in response to: sky_HALud
Anthony Goubard replied on Thu, 2009/10/22 - 10:34am
That's good news.
As people will use it, they will detect places in the code that is abnormally slow or using too much memory.
As they'll fix it, this will improve the reputation of Java in the community and in general (manager/user opinions).
Jess Holle replied on Thu, 2009/10/22 - 2:49pm
The sampling profiler is a huge addition.
Oddly one now has to use VisualVM to get this feature as NetBeans is still lacking sampling profiler capability (apart from the ability to get a sampling profile on the IDE itself).
Matthew McCullough replied on Wed, 2009/10/28 - 5:10pm
Endre Stølsvik replied on Sun, 2009/12/13 - 7:05pm