Configure VisualVM on Ubuntu 14.10

VisualVM is a kind of data gathering software for application which are running under the Java Virtual Machines (JVM). This retrieve information related to the Java application, like heap size, heap dumps, RAM utilisation, CPU utilisation, thread count and so on. There is an special interface that they use for getting information from application ends and gathered information is analysed and displayed on the VisualVM dashboard. Remote application also can be monitored via VisualVM. Specially user can get snapshot of heat dumps also.

Follow the steps to install VisualVM on Ubuntu server.
# sudo apt-get install visualvm
# which viaualvm
# java -version

You can check the java is up & running up using the commands given above. And for testing purpose, I’m here using a Java testing application in the same host. Let’s open the visualVM and configure it to get the information of running applications.

# visualvm

if you need any help related to visualVM you can us,
# visualvm - -help

After open the VisualVM, then you will see the terms and condition that should be accepted. Please accept it and go ahead.

VisualVm License Agreement

VisualVm License Agreement

After you agreed to the license agreement you will be displayed the VisualVM home page. In this home page you can see the options that you are having on VisualVm. In the Left side all the options are available. The image given below shows the sample home page of VisualVM.

VisualVM HomePage

VisualVM HomePage

To test an application, here I’m going to run a test application which contains a digital clock. Download the application using the following link.

https://www.evernote.com/shard/s565/sh/3ebfc539-ebda-47e8-a2fe-82dcdbaa16a8/996543f83e4a7c0e/res/3828d431-438b-4ee9-9571-e1574ec774ad/demo.zip

Download this file and extract, then run the testing java application on a terminal, then you will see the Digital clock on a particular application window.
# sudo unzip demo.zip
# cd src/
# javac DemoApp.java
# java DemoApp
After running the testing application, you will see the analytics of the application on the VisualVM dashboard. Locally running all the applications are added automatically to the VisualVM. Sample dashboard image is given below.

 

VisualVM dashboard

VisualVM dashboard

How to Add a Remote Host’s Application
In order to create a connection with a remote Java Application, can be used JMX connection with the remote host. JMX is Java Management Framework, which is used to monitoring, or manage any java based application which running remotely or locally. So this is a best way to use to monitor remotely running Java Application.
In order to run a particular Java application using JMX you have to add several settings on commands.
  1. com.sun.management.jmxremote.port :state which port is assigned to the Application.
  2. com.sun.management.jmxremote.ssl : State the SSL certificate settings.
  3. com.sun.management.jmxremote.authenticate : State the remote Authentication settings.
As an example, here the command that was used to open the DemoApp,
java -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false –
Dcom.sun.management.jmxremote.authenticate=false DemoApp
Before adding the remote application for VisualVM, user needs to add the remote host to the VisualVM dashboard. Go to the “Application” on left side and right-click on the “Remote Host”, then click on “Add Remote Host”, then you will be displayed window to add the remote host.
After adding the remote host, you can add whatever the application which are running on added remote host. So right-click on the remote host name and select “Add JMX Connection”, then enter the remote host name and the port number which was assigned previously. After adding those things you can see the added application is displayed under the remote host (Image given below).
Remote Host

Remote Host

After you double-click on the Application, dashboard will be loaded and retrieve analytics and data according to the application weight. In following image you can see, both application are in same dashboard.

RemoteApplication

Remote Application

In Visual VM dashboard consist of the four tabs. The descriptions for each tabs are given below.
  • Overview : Contains PID, Host name, arguments, heap dumb, so on, this provides basic idea of the running application.
  • Monitor : Processor consuming, memori consuming likewise utilisation detail.
  • Threads : List of entire threads, state of threads, running time, and so on.
  • Sampler : Sampling information, like CPU, memory.
 
Finally, I can state that VisualVM can be used to get analytics and mange Java based applications for maximum throughput.
Note : if you want to download this file as a PDF use the following Evernote Link, https://www.evernote.com/shard/s565/sh/3ebfc539-ebda-47e8-a2fe-82dcdbaa16a8/996543f83e4a7c0e

Thank You.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s