DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Java: How Object Reuse Can Reduce Latency and Improve Performance
  • Dust Actors and Large Language Models: An Application
  • Keep Your Application Secrets Secret
  • How Java Apps Litter Beyond the Heap

Trending

  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  • Unlocking AI Coding Assistants Part 4: Generate Spring Boot Application
  • Unlocking the Benefits of a Private API in AWS API Gateway
  • Breaking Bottlenecks: Applying the Theory of Constraints to Software Development
  1. DZone
  2. Coding
  3. Languages
  4. VisualVM: Free and Open Source Java Troubleshooter

VisualVM: Free and Open Source Java Troubleshooter

Trying to troubleshoot Java? VisualVM is a great, free, open source tool.

By 
Geertjan Wielenga user avatar
Geertjan Wielenga
·
Feb. 21, 08 · Analysis
Likes (0)
Comment
Save
Tweet
Share
68.7K Views

Join the DZone community and get the full member experience.

Join For Free

The 3rd milestone of VisualVM was released a few days ago. That release marks the open sourcing of this troubleshooting tool, together with the further polishing of its API. Perhaps this is therefore an opportune moment to spend some time exploring its main features. The key to understanding VisualVM is to see it as a bundling of a number of JDK tools, such as JConsole, jstack, and jinfo, combined with several new and advanced profiling capabilities. The tool is designed for both production and development use and further enhances the capabilities of monitoring and performance analysis for the Java SE platform.

All Java applications running on the same system as the VisualVM are listed in the "Applications" tab on the left side of the tool. Java applications on remote systems are also shown, under the "Remote" node. Information specific to each of the applications, which includes VisualVM itself, is displayed in the main part of the tool. For each application, there is an "Overview" tab showing general information, such as process ID and the Java version used to run the application.

The "Monitor" tab shows graphs for the application's heap, permanent generation, threads, and classes. The total heap space is shown in one color and the amount of heap space in use is shown in another. Below, you see the "Threads" tab, shwoing thread visualization for VisualVM itself:

VisualVM can read and interpret binary heap dump files. You can either generate a heap dump from within the VisualVM or you can open one, via the "Profile" menu at the top of the tool. The heapwalker part of the tool can then provide information about the dump, as shown in the next two screenshots:

The heapwalker can help you track down memory leaks. The instances view, shown above, shows all object instances of a class, from where you can find the nearest garbage collection root points.

VisualVM is pluggable. It comes with a Plugin Manager which already contains three plugins:

The VisualVM-MBeans plugin gives you an MBean Browser. It does the same as JConsole's MBeans tab: "The MBeans tab allows you to access the full set of the platform MXBean instrumentation. In addition, you can monitor and manage your application's MBeans using the MBeans tab." It lets you get and set MBean attributes and invoke MBean operations as well as subscribing for MBean notifications. Here's how it looks, once you've installed the plugin:

The Visual GC plugin gives you a graphic overview of information relevant to garbage collection:

Finally, your investment in JConsole plugins is protected, because they can be loaded into the VisualVM, in the same way as how they were loaded into the JConsole. First, you'd need to install "VisualVM-JConsole" plugin that is shown in the 4th pic above. Then, VisualVM is receptive to any JConsole plugin. For example, let's take the JTop plugin. JTop is a JDK demo that shows the thread CPU usage of all threads running in the application. This demo is helpful in identifying the threads that have high CPU consumption. This is how it is installed in the JConsole:

<JDK6>/bin/jconsole -pluginpath <JDK6>/demo/management/JTop/JTop.jar

 And, to install that same plugin into VisualVM, you simply open the etc/visualvm.conf file and then add the following to the "default_options" setting:

-J-Djconsole.plugin.path=<JDK6>/demo/management/JTop/JTop.jar

 For JTop, you'd then end up with the following, in a new tab, that is, the JConsole tab, provided by the aforementioned VisualVM-JConsole plugin:

With the release of the 3rd milestone, you can try out the APIs and create your own plugins. When you go to the download page for VisualVM, you'll see a link for the VisualVM binary as well as a Milestone 3 API Docs link. That gives you access to the Javadoc, as well as an overview of the entrypoints to VisualVM. However, note that the API is still in progress and cannot be considered stable yet.

You are welcome to join the mailing list and provide your feedback there.

Java (programming language) Open source application garbage collection

Opinions expressed by DZone contributors are their own.

Related

  • Java: How Object Reuse Can Reduce Latency and Improve Performance
  • Dust Actors and Large Language Models: An Application
  • Keep Your Application Secrets Secret
  • How Java Apps Litter Beyond the Heap

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!