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.
For all monitoring, you need to have the JDK (not the JRE which is just the Java runtime) installed.
Local monitoring
- Launch <jdk>/bin/jvisualvm.exe
- 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)
- Select your JVM process to be monitored
- Double-click the selection to start monitoring (a new window will open showing 4 graphs)
- 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.
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- Launch <jdk>/bin/jvisualvm.exe
- Select File > Add Remote Host
- In the Host Name field, enter the hostname or the IP address
- For remote monitoring, right-click the hostname in the nav-tree, and select Add JMX Connection
- In the Connection field, enter the host name and port number
- Enter your JMX port number (in this example: 8088)
The JMX connection appears in the navigation tree.
- Enter your JMX port number (in this example: 8088)
- Double-click the connection to start monitoring
To change the interval from the default to 24 hours, select Tools > Options, and enter 1,440 in the two Charts Cache fields
- After sufficient data is collected, right-click the host name in the navigation tree, and select Application Snapshot.
The snapshot appears with timestamp in the navigation tree under Snapshots. Right-click the snapshot, and select Save As to save the JVM monitoring data.
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