Skip to main content

Does Monitoring via JConsole add additional overhead to JVM

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2012-04-25


I am a newbie, I have question on Monitoring & Management via JConsole/VisualVM. I understand JConsole provides an efficient way of monitoring and managing remote MBeans residing on a remote JVM, but does it have an additional overhead to the system? Because if we keep JConsole up & running, every 4 seconds it will try to poll the Memory Usage (of Heap/NonHeap and various Memory Pools, etc) via JMX connector, and I believe the Memory Usage is calculated on the fly (via native API calls) as opposed to retrieving it from cache. So according to me there should be an additional overhead (may be negligible).

Can experts put some lights...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-04-25

I was curious about what's going on behind the scenes, once we start a remote JVM with argument, it starts the mbean server and open a rmi connector port to start serving client (typically jconsole's) request.
Now 2 things can happen at the time of retrieving and displaying Memory Usage (for example):
1. Jconsole requests the 'Memory Usage' of a Memory Pool
1.1 The request hit the remote MBean Server and retrieves the corresponding MemoryPoolMXBean Object.
1.2 Calls the getUsage() method of the MBean which in turn calls some native API [getUsage0()] to calculate the 'Memory Usage' on the fly and returns the same.

2. Once we start any JVM with JMX param enabled, a background Thread kicks off and every micro second interval it calculates the 'Memory Usage' of all available Memory Pools and stores it in some Data Structure, once JConsole requests the Memory Usage of a Pool..
2.1 The Request hit the remote MBean and retrieves the corresponding MemoryPoolMXBean Object.
2.2 Calls getUsage() method of the MBean which in turn retrieve the most recent Usage from the Data Structure and returns it to the JConsole.

I guess its the former one takes place.