简体   繁体   English

Tomcat堆转储创建

[英]Tomcat heap dump creation

In our Environment the tomcat server got hanged frequently then we increase the heap and restart the tomcat. 在我们的环境中,tomcat服务器经常挂起,然后我们增加堆并重新启动tomcat。

There is any another way to analyze the heap dumps in tomcat?? 还有其他方法可以分析tomcat中的堆转储吗? can we create the heap dumps in tomcat? 我们可以在tomcat中创建堆转储吗? if possible how? 如果可能的话如何?

Thanks Surya 谢谢苏里亚

First, you should analyze exactly what causes your Tomcat to hang. 首先,您应该准确分析是什么导致Tomcat挂起。 There are many reasons which can cause an application to "hang", eg dead locks, long GC pauses, etc. 有许多原因可能导致应用程序“挂起”,例如死锁,长时间的GC暂停等。

Looking at the heap dump makes sense if your Tomcat crashes with an OutOfMemoryError . 如果Tomcat因OutOfMemoryError崩溃而崩溃,那么查看堆转储是有意义的。 In that case you can use a tool like MAT to analyze the heap dump. 在这种情况下,您可以使用MAT之类的工具来分析堆转储。

You can create heap dumps any time with jcmd <pid> GC.heap_dump <file> . 您可以随时使用jcmd <pid> GC.heap_dump <file>创建堆转储。 You can also set the VM option -XX:+HeapDumpOnOutOfMemoryError . 您还可以将VM选项设置为-XX:+HeapDumpOnOutOfMemoryError This will dump the heap automatically when you get an OutOfMemoryError . 当您收到OutOfMemoryError时,这将自动转储堆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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