Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracking memory usage in a tomcat webapp

Tags:

java

memory

Are there any good tools available to track memory usage In a tomcat java webapp? I'm looking for something that can give a breakdown by class or package.

Thanks, J

like image 240
Snukker Avatar asked Dec 22 '22 13:12

Snukker


2 Answers

I use the Netbeans IDE and it is able to profile any type of Java project including webapps. Once you have the project setup in Netbeans you just click Profile and answer a few easy questions.

It is very easy to create a new project and import your existing code into it.

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

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

VisualVM may also work for you. There are also a number of plugins available for it. VisualVM has been shipping with the JDK since JDK 6 update 7. You can check it out here: https://visualvm.dev.java.net/

like image 179
Sarel Botha Avatar answered Jan 04 '23 15:01

Sarel Botha


jconsole can give you summary statistics. I've used it in the past while load testing to infer the size of loaded classes (by noting the before and after usage when loading LOTS of objects.) Note that the usage keeps going UP until a garbage collection is triggered, so you will need to account for transient objects in your calculations.

like image 31
Chris Nava Avatar answered Jan 04 '23 15:01

Chris Nava