开发者社区> 问答> 正文

Tomcat GC问题,求大神帮忙!

参数配置如下:
-Xms1024m -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:D:/Server/Tomcat-7.0.63/logs/tomcat_gc.log -XX:+DisableExplicitGC
然后今天突然出现了频繁的Full GC导致tomcat假死了,GC日志如下,求大神看看应该怎样优化啊?
screenshot

展开
收起
a123456678 2016-03-10 11:51:59 2479 0
1 条回答
写回答
取消 提交回答
  • 出现这个问题的原因是tomcat 7的一个默认配置(JreMemoryLeakPreventionListener)

    方法一:可以在JVM启动参数中加入-XX:+DisableExplicitGC来禁止System.gc()。当然这个方法不太好,你也可以用另一种方法:

    方法二:
    在html中:

    Thank you Konstantin and Chris for your attention.

    As stated in the initial post:
    'We have recently deployed tomcat-6.0.28 in our organization and are
    noticing every hour, a Full GC is occurring. The same application,
    same JVM, same JVM args, just a new tomcat release.'

    Using the default JreMemoryLeakPreventionListener configuration that
    has 'gcDaemonProtection=true' will result in 1hr FullGCs using Sun
    1.6 b18, b20 and b21on Solaris and Windows. We've tested and
    successfully 'contained' the FullGC behavior using one of the below
    configurations:

    1) suppress the FullGC using JVM arg -XX:+DisableExplicitGC

    2) keep the FullGC but to defer to the CMS collector using JVM arg
    -XX:+ExplicitGCInvokesConcurrent

    3) gcDaemonProtection="false"/>

    4) Disable the listener altogether

    We've decided to go with option 3.

    2019-07-17 18:57:22
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Apache Tomcat 的云原生演进 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载