Friday, October 5, 2018

How to Get and Run VisualVM for Profiling

How to Get and Run VisualVM

The good news here, you actually don’t need to do anything, it is already available in the JDK bin directory. It’s available after JDK 1.6 update 7. Once you are in the bin directory of JDK, you will find jVisualVM.exe; just click on it, and the application starts up.

Step 1: Go the Java Bin directory and click on the jvisualvm.exe
Step 2: On clicking the above .exe we will get the following screen.


Step 3: When we run the Tomcat, then automatically the pid will be detected by VisualVM and will be showing in the following manner.





The on top-left you can see application tab, and under this, you can see different options like Local, Remote and Snapshots. To set a remote application profiling, you must connect to the remote server and add that application:
VisualVM Options

Local Applications
While setting up the remote application, you can give it name as well, “Display name:.”


Benefits

There are many important features that VisualVM supports, such as:
  1. Visual interface for local and remote java applications running on JVM.
  2. Monitoring of application’s memory usage and application’s runtime behavior.
  3. Monitoring of application threads.
  4. Analyzing the memory allocations to different applications.
  5. Thread dumps – very handy in case of deadlocks and race conditions.
  6. Heap dumps – very handy in analyzing the heap memory allocation.
So if you see the above list, you can actually monitor your applications — both local and remote — which is quite handy in case of a run time exception, like outOfMemoryException, deadlocks, race conditions, etc., as you get to visually see which objects are causing an outOfMemoryException, for example, or the objects/resources causing thread deadlock.





No comments:

Post a Comment

Recent Post

Databricks Delta table merge Example

here's some sample code that demonstrates a merge operation on a Delta table using PySpark:   from pyspark.sql import SparkSession # cre...