Tracking memory usage in tomcat webapp

Are there any good tools for tracking memory usage. In tomcat java webapp? I am looking for something that can give a breakdown by class or package.

Thanks J

+4
source share
3 answers

I use the Netbeans IDE and it can profile any type of Java project, including webapps. When you have a project setup in Netbeans, you simply click on "Profile" and answer a few simple questions.

It is very simple to create a new project and import the existing code into it.

You can see screenshots of this here: http://profiler.netbeans.org/

You can download Netbeans here: http://www.netbeans.org/

VisualVM may also work for you. Several plugins are also available for him. VisualVM has been shipping from the JDK since the JDK 6 was updated. You can check it here: https://visualvm.dev.java.net/

+5
source

jconsole can give you summary statistics. I used it in the past when testing load to determine the size of the loaded classes (noting before and after using LOTS objects when loading LOTS.) Please note that use continues until garbage collection starts, so you will need to consider temporary objects in your calculations.

+3
source

Try the memory leak detector that comes with JRockit Mission Control . It can show you what types of classes are most common on the heap and how much they grow.

alt text http://download.oracle.com/docs/cd/E11035_01/jrockit/intro/wwimages/memleak2.gif

You can also get statistics from the command line by running the jrmcd command, available in the JROCKIT_HOME \ bin directory. For instance,

jrcmd <pid> print_object_summary

will provide you

 31.8% 3198k 41907 -137k [C 11.9% 1196k 300 +0k [B 11.4% 1151k 49118 +6k java/lang/String 6.1% 612k 5604 +0k java/lang/Class 4.3% 431k 2388 +0k [I 3.5% 353k 15097 +0k java/util/HashMap$Entry ... 

It can be used for design and evaluation.

+3
source

All Articles