My life as a JBoss application developer just became a whole lot easier. I discovered the jconsole.exe tool provide in the 1.5 JDK. This tool provides exactly the real-time memory reporting that I need.
The best part is that it provides a breakdown of each memory space so that I can tweak the settings when I watch the application perform under load. Notice in the screenshot below the five green bars in the lower-right hand corner. That is each memory space (Eden Space, Survivor Space, Tenured Gen, Code Cache, and Permanent Gen) updated real time with how much allocated memory is being used.

To get your app enabled to be monitored by jconsole, though, is very arduous and time consuming. Here are the steps.
1. Add the following system properties to your JVM startup command.
2. Restart your instance.
See how hard that was? You broken a sweat yet? No? Ok well there’s more work involved. Now you have to open up a command prompt and type the command ‘jconsole’. If your JDK’s bin directory is not on your path, either add it or open your command prompt in that path.
When the console fires up, go to the remote tab and fill in your IP address and the port number that you specified above, and then click Connect. You’ll then see the summary screen shown here.

If you have broken a sweat by now, then you either need to turn the heat down or stop typing so hard. I couldn’t believe how easy it was to finally get a tool to monitor an application!
For an exhaustive review of jconsole’s features, visit Sun’s reference page
7 Responses for "JVM Memory Monitoring"
Hi Steve,
I cannot use jconsole from my computer to connect the remote server.
I followed the two simple steps, but I always have “connection failed”.
Any ideas???
Thanks
@Patricia, have you verified that the port you entered into your JVM switches matches the port on which JBoss is running?
Do you have access to the IP on which your server is installed?
I can ping the server IP from my computer.
How can I check the port to JBoss.
Sorry, but I’m totaly new on that
The port is USUALLY 8080 (in a default installation), but you can verify by looking in the server.xml file in the deploy\jboss-web.deployer, or deploy\jbossweb-tomcat50.sar directory.
Steve, why do we need jboss?
I just want to monitor my application in ColdFusion 8. I installed the last JDK on my computer and, I modified the vile jwm.config on my server (where ColdFusion is ). I dont know why do I need a JBoss???
Hi Steve,
I still have problem accessing my application through JConsole.
1. I change the management.properties in JDK_HOME\jre\lib\management
with uncomment
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.port=6789
May i know i need to change the management.properties in the JDK in the server and not on my desktop?
2. After the step 1, i do not know how to restart the JVM? So, i straight go to step 3.
3. I go to command prompt, went to JDK_HOME\bin, then type jconsole. There is a window prompt out. I would like to monitor my application running on hostName:sbbann and port running Tomcat is 8080. So, in the window prompt, i insert the hostName and port as sbbann and 8080, but userid and password i leave it blank. But it still show connection failed.
Please advice whether the steps i mention, is it the correct way??
@Jade: It’s been a looong time since I’ve worked with JConsole, so I can’t answer your question. I’d suggest going to a Java-related discussion forum, and asking some experts there.
Sorry I couldn’t help you.
Leave a reply