user1717230
user1717230

Reputation: 453

How do get heap dump and thread dump for Tomcat in Mac

I am trying to analyize the memory usage for a application that is being deployed in Tomcat.

I need to get the heap dump and thread dump while the application is running in tomcat.

Can anybody let me know how to get those dumps in mac from terminal for Tomcat.

I tried getting tomcat PID using "ps ux | grep apache" and then did "kill -3 PID", but nothing happens...

Upvotes: 0

Views: 5028

Answers (2)

Gile Champion
Gile Champion

Reputation: 299

After you executed kill -3 PID ,where is PID process id of Apache Tomcat, thread dump will be written into /tomcat/logs/catalina.out

Upvotes: 0

Fabian Lange
Fabian Lange

Reputation: 1856

it depends on the JVM you use to run your Tomcat. I strongly recommend to run all applications and servers using the JDK (in case of HotSpot, which you likely use). Then you should have multiple utilities at hand:

  • jps - for finding your pid
  • jstack - for getting thread dump
  • jmap - for getting the heap dump.

or you use jvisualvm which bundles all the tools into a nice ui. Last, but not least, it is possible that you have gotten the wrong PID :-)

Upvotes: 1

Related Questions