Using JConsole to monitor ColdFusion's JVM

Categories: HTML/ColdFusion, Java

If you're experiencing problems with your server or just want a better idea of how your server's using memory, the Java JDK provides an excellent monitoring tool called JConsole.

JConsole comes included in the latest Java JDK and can be found in the JDK_HOME/bin folder (where JDK_HOME is the installation folder for your JDK). ColdFusion does not come with the JConsole application, so you'll need to download and install the JDK on a machine that has access to your server (if you do not already have a JDK installed.) JConsole does not need to run on the ColdFusion server, you can connect to a remote server so you can run the application right from your Workstation.

In order for JConsole to connect to your server, you'll need to edit your CFUSION/runtime/bin/jvm.config file (where the CFUSION is your ColdFusion installation folder.) Before editing the jvm.config file, always make a backup.

You'll want to add the following arguments to your java.args property:

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=<port>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

The arguments should all be on a single line and then go after the -server argument—which should always be the first switch in the arguments line. (Thanks goes to Steven Brownlee's Blog for the above argument information.) Also, make sure to change <port> to an open port on your server. I used port 9500.

Make sure to read the Using JConsole that Sun has published. It'll walk you through configuration, connecting and how to use the tool. JConsole will provide lots of really good information about the state of your server. Here's what the application looks like:

Related Blog Entries

Comments

marc esher's Gravatar Good stuff Dan. I'm wondering if you hit the same issues I did: first, I had to ensure that CF was running under the same account as was used to start up jconsole. This one baffled me for a while... I was getting an "unable to map user to vmid" error. The 2nd bugaboo was getting hooked into the specific CF process. With java, I've always used jconsole with a URL; but with CF, I couldn't get that working. Turned out to be as simple as just plugging into the PID (i.e. jconsole 4567).

Thanks for sharing!
James Netherton's Gravatar Thanks for this - I was trying to get this up and running last week but didn't realise you have to add the jvm args into the jvm.conf file! Doh!
robi's Gravatar Glad you found Jconsole useful Dan. Sometime when you have time I should walk you through all the tools I use
Troy Allen's Gravatar @Marc - How do you know what PID CF is running under?
Marco Silva's Gravatar @Troy - you can look at the Event Viewer and look for the mesage after CF started.
Somthing like:
"The JRun cfusion_3 service for the "cfusion_3" server was started. PID is 1308."
Where "cfusion_3" is the instance name and commonly the service name too.

Marco.
Patrick Steil's Gravatar Just wanted to add that I was able to successfully set this up also thanks to your blog...

As soon as I changed the JVM config settings as you directed and restarted CF, I went to another server where I had the JDK installed, fired up JConsole and then under "Remote Process" entered 10.10.10.40:9500 and was able to connect to my server...

Thanks so much!
Patrick

Add Comment



If you subscribe, any new posts to this thread will be sent to your email address.