Remote monitoring and collection of performance data using JMX and VisualVM for a Java environment.
1. Either on the problematic system or on a remote system install the VisualVM software for data collection.
2. For the Java environment being monitored. The following JVM properties are needed (more information on these can be found here). Make sure to add these BEFORE the javaagent:
-Dcom.sun.management.jmxremote.rmi.port=9011 <not needed in most cases>
-Djava.rmi.server.hostname=<server IP address, really only needed if there are multiple Nic cards>
|Note! Port 9010 will be used later when connecting to the hostname/port defined with VisualVM|
The following example shows the properties along with the Java agent:
java -Dcom.sun.management.jmxremote.ssl=false \
-jar webgoat-container-7.1-exec.jar \
3. Start up the Application and check to ensure the 9010 port is listening.
|Note! If running remotely you may need to open up the systems firewall to allow the connection from VisualVM.|
4. Launch VisualVM and add a Remote Host:
5. Then add the JMX Connection:
6. Once connected you will start seeing live threads within the JVM along with Contrast:
7. Click on the Sampler tab, then select the CPU button to start collecting data on CPU performance:
8. Recreate the performance problem while this is running.
9. Once recreated select and export the data
10. To collect Thread data select the Threads tab and select Thread Dump:
This will open a separate tab where all the text should be copied and pasted into a text document:
11. Lastly to collect details on the environment. Right click on the Remote Host connection and select Application Snapshot:
This will show up under the snapshots menu, right click and save this:
12. At this point you should have collected the CPU snapshot, thread dump and application snapshot. These should be zipped up and sent to support. If the resulting files are large, ask your support rep for a SendSafely link to post them to.
- How to collect Java Flight Recorder (JFR) data for troubleshooting application performance
- How to generate a YourKit session