Skip to Content

How to setup java visual virtual machine

How to setup java visual virtual machine
utility and connect to SUP 2.x.x

Purpose

This technical document explains how to monitor and capture Java Virtual Machine
using the java Visual virtual Machine utility that is shipped with the SUP/SMP server
versions of Java JRE’s. This will give you the ability to capture schedule refresh,
Garbage Collection as well as the ability to perform SPID dumps thread dump or
complete JVM heap dumps.

Required Software

1.            SUP or SMP 2.x.x Server

2.            JRE/JDK that is shipped with SUP or SMP server

Assumption

This document assumes you have a working SUP environment.
You have Administrator rights to the Operating System and SUP.

Step 1 – Configuration steps need to enable monitor.

User needs to connect to the SUP’s JVM pool to monitor.

Solution

In order to connect to the JVM pool we need to create a service connection
in SCC JVM pooling.

  1. Start Sybase Control Center (SCC).
  2. Log in as supAdmin.
  3. Go to the folder Servers then your server name.

4.    Go to Server Configuration.

  1. On your right hand side go to the General Tab.
  2. On your right hand side go to the General Tab.
  3. Next go to Users options.
         You will see a line similar to this one.
         -XX:MaxPermSize=256M -XX:HeapDumpPath=D:\Sybase\UnwiredPlatform\
          Servers\UnwiredServer/logs -XX:+HeapDumpOnOutOfMemoryError
        
        
  4. The line above is used to configure the JVM that the SUP uses.
        
        
  5. We need to add the follow three lines make sure there is a  single space between
    each command.
        
    -Dcom.sun.management.jmxremote.authenticate=false

-Dcom.sun.management.jmxremote.ssl=false

-Dcom.sun.management.jmxremote.port=8086

  1. Here is the complete line note it is continues line for reading it is wrapped around in
    this write up to t fit the screen.
  2. -XX:MaxPermSize=256M -XX:HeapDumpPath=D:\Sybase\UnwiredPlatform\
    Servers\UnwiredServer/logs
    -XX:+HeapDumpOnOutOfMemoryError
    -Dcom.sun.management.jmxremote.port=8096
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false

             


   
Figure 1

4.    Add the three lines to the User Option.

5.    Click the Save Button

6.    You will need to restart the SUP server so the changes will take effect.

7.    In SCC go to Servers folder icon.

8.    On the right hand side select the server name.

9.    Click the restart button.

      Figure 2

This concludes the steps needed to add a service connection in SCC that will allow us
to connect to the SUP’s JVM processes using the java visual virtual Machine utility.


Starting and connecting to the SUP’s JVM using the java visual
virtual Machine utility.
    

In order to connect to the JVM pool we need to perform the following steps.

After restarting the SUP server we need to check and make sure the port we configured is
truly listening.
Perform netstat –a at a command prompt
and look for the local host and port 8096 that we defined in the JVM options
-Dcom.sun.management.jmxremote.port=8096

TCP    0.0.0.0:8096           BEDN00530745A:0        LISTENING

Figure 3

Now that we have confirmed that we have established a listen port to the JVM
we can now proceed to connect and start monitor.

The following steps will start the jvisualvm

1-    Go to windows and open the following path
C:\Sybase\UnwiredPlatform\JDK1.6.0_31-x64\bin.
Your path maybe different it is dependent on where you installed SUP/SMP.

Double click on jvisualvm.exe to start the application.

1-    Once started you will see the following screen.

Figure 4

2-    Go to the top menu and select file then Add JMX Connections.

             Figure 5

Figure 6

3-    On the next screen you will need to add your machine name and the
port number 8096. As an alternative you could use localhost and port
number 8096

Figure 7

4-    Click OK

5-    If you get a connection error then try and change the port number in SCC
and restart. I did have issue with port 8086 so I just changes to port 8096.
Also I found that using the Server Name or TCP/IP address also did not
work unless I was on a remote machine so use localhost.

 

Figure 8 is showing that you are now really connected to the SUP’s JVM.
For further confirmation look at the PID 12512 using a utility like process explorer
and task manager see Figure 8 we can track down the SPID to see who it belongs to.
Note your SPID may be different.  



Figure
8

By looking at the SPID we can confirm we are talking to the the SUP’s Servers JVM.

This concludes the steps needed to start and connect to the SUP’s JVM
on port 8096

User needs to monitor active threads and garbage collecting activities.

Solution

In order to do that, you will need to do the following steps.

From the menu Tabs you will have the following options Monitor, Threads,
Sampler.

Figure 9

Monitor Tab will provide you the following items to monitor
CPU, Memory, Threads and Classes. Also Note from the Tab
we can perform Garbage collecting and a Heap Dump.

Figure 10


Figure 11

The Threads Tab Options :                                       


Threads very detailed and you can monitor them. Threads tab have option to monitor and
report on sleeping threads active thread. You also have the option to DUMP a thread
this is very use full with having issues or you want to see what the thread was doing.

Figure 12

The Sampler Option:

Sampler is used to sample the CPU processes you can perform a snap shout
this is use full when you have a lot of active threads and you want to see the
CPU processing them.

Figure 13

Summary

The jvisualvm utility is available with all JDK and is very easy to user. It provides easy access to
the SUP JVM for monitoring and really takes away the unknowns and shows the processing CPU
Memory and Garbage collection process. What threads are active and what threads are sleeping.
Thread dumps and memory dumps can be controled and performed with out causing
any addtional over head.

Tags:

No comments