简体   繁体   中英

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...

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 :-)

执行 kill -3 PID 后,Apache Tomcat 的 PID 进程 id 在哪里,线程转储将写入 /tomcat/logs/catalina.out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM