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.

JConsole Memory

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.

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port={any unused port}
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

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.

JConsole Main

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