Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

One of our production Tomcat boxes runs two webapps. One is ours, another is a black box app that our vendor supplied to "help" with our app.

We are, unfortunately bumping up against memory limits on our production box, and I'm working to add RAM and have Tomcat start with more memory available for the JVM. Before I do this, however, I'd like to see which of these two webapps is eating up all the RAM!

Is there an option within the built-in Tomcat manager that shows RAM usage by webapp? If not, is there a free solution available, somewhere, that offers this level of diagnostic availability?

If need be, I am open to writing my own lightweight webapp to do it, and have one running on the machine that watches the other two.

Thanks,
IVR Avenger

share|improve this question

6 Answers 6

up vote 0 down vote accepted

Take a look at Tcat Server from MuleSoft, it can provide you tons of information on memory utilization. You can use it with your existing Tomcat installation.

share|improve this answer

Try using JMX. Enabling this should be as simple as adding the following line to your startup script:

JAVA_OPTS=$JAVA_OPTS:"-Dcom.sun.management.jmxremote.port=8090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

As you can see, there are options for encryption and authentication to satiate your local Manager of Paranoia.

You didn't mention what monitoring system you're using; you'll probably have to set that up to be able to talk JMX as well. Zabbix has Zapcat, Here's some OpenNMS instructions, and here's a Nagios plugin.

share|improve this answer

Unfortunately, I don't think there is any way to break down RAM usage by individual web application, even using JMX. However, just for this experiment, you could try running each web application in its own Tomcat instance. Then measure the memory usage of each separate JVM.

share|improve this answer

Have a look at lamdaprobe it's a small webapp that can even hook to JMX and give you lot of valuable infos: http://www.devx.com/Java/Article/35659/1954

beware that access to this app should be given only to administrators

share|improve this answer

Zenoss will let you watch the server running tomcat, the tomcat process and monitor it via JMX as well. There's a fair amount of documentation and it's open source.

share|improve this answer

You can break down the memory inside the server by classes and by references, but it is a bit technical. Just take a heap dump at some point in time with jmap or jconsole or jvisualvm or -XX:+HeapDumpOnOutOfMemoryError. Then open it with Eclipse MAT or JHat.

Then if you want more monitoring : http://javamelody.googlecode.com (memory charts and breakdown by classes included)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.