JVM Monitor is an open-source Java profiler that plugs into the Eclipse IDE. It lets you watch the CPU, memory and thread usage of a running Java application without leaving Eclipse.
Why use it?
JVM Monitor is handy when you want a quick look inside a Java application. You don't need to prepare a launch configuration first. It finds the JVMs running on your machine automatically, so you can start monitoring one in a couple of clicks. It can also monitor an application on another machine if you give it the hostname and port.
What it shows
| View | What you see | Useful for |
|---|---|---|
| Timeline | Charts of used heap, loaded classes, thread count and CPU usage | Spotting trends during a test run |
| Threads | All threads, including deadlocked ones and threads using a lot of CPU | Finding deadlocks and busy threads |
| Memory | A heap histogram with object count and size per class | Finding classes that hold the most memory |
| CPU | A CPU profiler you configure and run, then analyze call by call | Finding where CPU time goes |
| MBeans | Attributes you can view and edit, plus operations you can invoke | Reading or changing settings an application exposes through JMX |
Getting started
- In Eclipse, go to Help > Eclipse Marketplace, search for "JVM Monitor" and install it. Restart Eclipse when asked.
- Go to Window > Open Perspective > Other and choose the Java Monitor perspective. The JVM Explorer lists the Java processes running on your machine.
- Right-click the JVM you want and choose Start Monitoring. The Timeline, Threads, Memory and MBeans pages open.
- When you finish, right-click the JVM and choose Stop Monitoring.
Monitoring a remote JVM
To monitor an application on another machine, start that application with JMX remote access turned on. For example:
java -Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar your-app.jar
Then, in JVM Explorer, click Add JVM Connection on Remote Host and enter the host and port. If the remote JVM requires a login, enter the credentials too.
Turning off authentication and SSL, as in the example, is only safe on an isolated test network. For anything else, turn both on.
Using it during performance tests
Run your load test while JVM Monitor is attached to the application server. Three things are worth watching:
- Heap usage: If used heap keeps climbing after garbage collection, you may have a memory leak. See Why Memory Leaks Often Go Unnoticed Until Load Testing.
- CPU usage: If it stays high, see How to troubleshoot high CPU utilization during performance testing.
- Thread count: A count that grows without levelling off, or threads that stay blocked, point to contention or a deadlock.
CPU profiling adds overhead, so don't leave it running during the runs where you record response times.
Before you rely on it
The documentation I found for JVM Monitor 3.8.0 lists support for Eclipse up to Juno (3.8 and 4.2) and Java 6 or 7. Check that it works with your Eclipse and Java versions. If it doesn't, JConsole, VisualVM, and Java Mission Control with Java Flight Recorder offer similar monitoring for current Java versions.

Thanks for the post. It was quite interesting.
ReplyDeleteJava classes in Pune