JVM monitoring


There are 3 ways to monitor a target JVM:

Local monitoring is preferable when the JVM monitoring arguments have not been set and monitoring is needed immediately but a JVM restart is not feasible. The drawback to running local monitoring is that the monitoring tool itself (jvisualvm.exe) requires CPU/memory resources and thus affects the behavior of the target JVM running on the same machine.

Remote monitoring is the most desirable method because of low overhead and a single running instance of jvisualvm.exe can monitor multiple JVM targets. The overhead is so minimal that monitoring of a running production environment is possible. (All benchmarks published by the BMC Performance Team were done with the monitoring on.)

Starting with AR Server version 9.0, monitoring of the AR Server can be done via RMI so no additional JVM args are necessary. You need to have the admin credentials to the AR Server to enable monitoring.

Note

When collecting JVM monitoring data for analysis, collect at least 24 hours of usage data. This captures peak and off-peak data for a more accurate picture of the JVM behavior.

For all monitoring, you need to have the JDK (not the JRE which is just the Java runtime) installed.

Local monitoring

  1. Launch <jdk>/bin/jvisualvm.exe 
  2. Locate your local JVM process to be monitored in the left nav-tree under "Local" (in the picture, the 2 local JVM processes are VisualVM, which is the jvisualvm.exe tool process and the Tomcat process)
    Clipboard01.png
  3. Select your JVM process to be monitored
  4. Double-click the selection to start monitoring (a new window will open showing 4 graphs)
  5. To save the collected data and to change the monitoring interval to 24 hours from the default 60 minutes, see step 8, 9, and 10 below

Remote monitoring

For remote monitoring, you need to start the JVM with the JMX protocol enabled (JMX agent running and listening to an assigned port in the target JVM to be monitored). Then, from a remote computer (can also be local computer), launch <jdk>/bin/jvisualvm.exe and attach to the target JVM process to start the monitoring. (A remote computer is preferable so that monitoring does not affect the monitored target JVM.)

The following procedure explains how to remotely monitor the JVM process on the computer twiddler through port 8088 with no authentication, which is the easiest setup. You can add the authentication later when you have the monitoring process mastered. In the case of remote monitoring, be sure your port choice is free and accessible from the remote computer.

You can use a single instance of jvisualvm to monitor multiple target JVM’s. Additionally, you can monitor a single JVM process from multiple remote locations by running a jvisualvm instance on each remote monitoring machine.

  1. Start the JVM with the following additional arguments:

    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=8088
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.authenticate=false
  2. Launch <jdk>/bin/jvisualvm.exe
  3. Select File > Add Remote Host
  4. In the Host Name field, enter the hostname or the IP address
  5. For remote monitoring, right-click the hostname in the nav-tree, and select Add JMX Connection
    AddJMXConnection.gif
  6. In the Connection field, enter the host name and port number
    • Enter your JMX port number (in this example: 8088)

      Twiddler-8080.gif
       The JMX connection appears in the navigation tree.
  7. Double-click the connection to start monitoring
    DoubleClickConnection.gif
  8. To change the interval from the default to 24 hours, select Tools > Options, and enter 1,440 in the two Charts Cache fields
    ChartsCache.gif

    Note

    The network connection must remain intact during the 24 hours period. The application snapshot will not be able to monitor if the connection is lost.

    Ensure that no such security measures are enforced that might break the network connection due to perceived inactivity.

  9. After sufficient data is collected, right-click the host name in the navigation tree, and select Application Snapshot.
    ApplicationSnapshot.gif

     The snapshot appears with timestamp in the navigation tree under Snapshots.
    ApplicationSnapshot-Twiddler.gif
  10. Right-click the snapshot, and select Save As to save the JVM monitoring data.
    ApplicationSnapshot-SaveAs.gif

    Warning

    Do not use the Microsoft Remote Desktop Protocol (RDP) desktop to copy and paste the snapshots to another computer. Use FTP or the network file system (NFS). RDP copy and paste causes file corruption so that jvisualvm can no longer read the file for analysis.

Remote monitoring of the AR Server via RMI

This method for monitoring works only for the AR Server version 9.0+: In the ar.cfg file, the default port for "Jmx-port" is 61500. If you modify this, then you must also modify the URI to match your port choice.

The procedure is nearly identical as for remote monitoring but without the necessity of setting the JMX args for the JVM, i.e., skip step 1. And for step 6, instead of putting in hostname (or IP address) : port number, put in the following URI: service:jmx:rmi:///jndi/rmi://<hostname or IP of AR Server>:61500/ARServer and use the AR admin credentials. Check the "Do not require SSL connection".

For example, our AR Server is running with IP 172.19.50.103, so for step 6, we put in the URI: service:jmx:rmi:///jndi/rmi://172.19.50.103:61500/ARServer

Clipboard02.png

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*