Open In App

How to Install VisualVM in Linux

Last Updated : 28 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

When operating on a Java Virtual Machine, the sophisticated tool VisualVM offers a visual interface for viewing in-depth details about local and remote Java applications (JVM). To see the program within the JVM, it makes use of and integrates some of the command-line tools that the JDK offers; this package consists of the command-line tools jmap, jstack, jConsolem, jstat, and jinfo. These utilities are all included in the typical JDK release.

Usage of VisualVM

The performance of Java applications may be monitored and enhanced using Java VisualVM by Java application developers. Java VisualVM enables developers to execute and monitor garbage collection, produce and analyze heap dumps, find and fix memory leaks, explore and interact with the platform’s MBeans, and do light memory and CPU profiling.

The following are only a few of the essential features that VisualVM supports:

  • Visual user interface for Java programs operating on the JVM locally and remotely.
  • monitoring of the memory use and behavior of the program during runtime.
  • thread-level application monitoring.
  • examining how much RAM is given to various apps.
  • In the event of deadlocks and race situations, thread dumps are quite useful.
  • Heap dumps are incredibly useful for studying heap memory allocation.

You can actually monitor your applications, both local and remote if you look at the list above. This is useful if a run-time exception occurs, such as an out-of-memory exception, a deadlock, a race condition, etc., because you can visually identify the objects that are, for example, causing an out-of-memory exception or the resources that are causing a thread deadlock.

For VisualVm installation in Ubuntu, there are two methods.

  • Method 1: Install VisualVM using Ubuntu Software Center
  • Method 2: Install VisualVM Using aptitude

Method 1: Install VisualVM using Ubuntu Software Center

Step 1: Open the Ubuntu Software application

Ubuntu Software application.

 

Step 2: Search the VisualVM application in the Search bar.

Search VisualVM

 

Step 3: Click on the install button to install the application.

Click on install button to install it.

 

Method 2: Install VisualVM Using aptitude

Step 1: Open your terminal.

Step 2: Update the repositories using the below command.

sudo apt update
Updating software.

 

Step 3: Install VisualVM by writing this command,

sudo apt install visualvm
Installing VisualVM using apt

 

Example of VisualVM

Step 1: Here is a list of every JVM-using program on your local system. One of my running spring boot applications, identified by the Pid 500847, is displayed at the end of the list. Not only can you see local applications, but you can also see some that are running on a remote server. 

List of running applications.

 

Step 2: Simply click it to bring up a new window with the application’s information, as shown below, if you wish to see it. You will see details like PID, host, the Main class, JVM parameters, and many more.

Overview of specific application.

 

Step 3: By selecting it in the monitor window, an application may be watched. This page contains a wealth of information, but the two most important are CPU and memory utilization. Additionally, it will display the classes and the total number of threads. You can get Heap Dump from here.

Monitor of the application.

 

 

Step 4: The Threads window offers access to the threads. Live threads and daemon threads are two different types of threads. Additionally, you may keep track of every thread that a program is executing. Additionally, ThreadDump may be produced from here.

Threads of the application.

 

Conclusion:

When we need to see how much memory and processing power our program is using, this feature is quite helpful. Applications frequently operate in multithreaded environments, and we may create thread dumps and examine their use for that reason.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads