简体   繁体   English

Tomcat 7-我的堆转储是否泄漏?

[英]Tomcat 7 - has my heap dump leaks?

We have Tomcat 7(0.0.47) in test environment and I decided to take heap dump from it to see if everything is OK with our memory. 我们在测试环境中有Tomcat 7(0.0.47),我决定从中进行堆转储,以查看内存是否一切正常。

It contains three apps - one is jersey+spring rest web app, another is web app with almost no incoming http requests, but quartz with heavy business logic and the third one is lightweight web app that supports some jmx points to work with some classes. 它包含三个应用程序-一个是jersey + spring rest Web应用程序,另一个是几乎没有传入的HTTP请求的Web应用程序,但是石英具有很强的业务逻辑,而第三个是支持某些类的jmx点的轻量级Web应用程序。

In visualvm I see some values that scare me. 在visualvm中,我看到一些让我感到恐惧的价值观。 I wonder if its OK or something went wrong? 我想知道它是否还好或出了什么问题?

  1. WebappClassLoader for jersey rest app has retained size 25 364 571, while class loaders for other two apps are significantly smaller - about 5KK and 8KK. 用于jersey rest应用程序的WebappClassLoader保留了25 364 571的大小,而其他两个应用程序的类加载器则要小得多-大约5KK和8KK。 Is it OK? 可以吗

  2. Summary tab shows me that i had 337 classloader and 3376 GC roots? 摘要选项卡显示我有337个类加载器和3376个GC根目录? Isn't that too much? 那不是太多吗? and Total instances: 1 573 037 和实例总数:1 573 037

  3. I also tried to take dump without :live option a bit later (after half an hour) and i saw on a summary that i have almost same amount of classloaders (346) and GC roots (3329). 我还尝试稍后(半小时后)不带:live选项的转储,并且在摘要中看到,我有几乎相同数量的类加载器(346)和GC根(3329)。 But the size of "live and dead" dump is much bigger that size of "live" dump - 926Mb vs 390Mb. 但是,“活动和死亡”转储的大小比“活动”转储的大小大得多-926Mb和390Mb。 Is it OK or do I have some memory leaks? 可以,还是我有一些内存泄漏?

  4. I looked at big classloader dump and I see that the biggest retained size in it has HashMap resourceEntries. 我看了看大的类加载器转储,发现其中最大的保留大小是HashMap resourceEntries。 What does this hashmap represent? 该哈希图代表什么? Should I look through unused external libraries and exclude them to reduce this size or is it OK? 我应该浏览未使用的外部库并排除它们以减小此大小,还是可以吗?

Sorry for some kind of dumb questions, i'm a bit newbie at memory optimization 抱歉有些愚蠢的问题,我在内存优化方面有点新手

  1. How much memory do you have allocated to your servers? 您已为服务器分配多少内存?
  2. What are your GC flags? 您的GC标志是什么?

Has your production application fallen over with an OutOfMemoryException for either PermGen or Heap? 您的生产应用程序是否因PermGen或Heap的OutOfMemoryException而崩溃了? If not, and your servers have been up for > 1 week, then no, you most likely do not have an issue. 如果没有,并且您的服务器已经运行了超过1周的时间,那么没有,您很可能没有问题。

Edit: as commented below, some GC tuning might be in order: 编辑:如下所述,可能需要一些GC调整:

JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"

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

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