参数配置如下:
-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日志如下,求大神看看应该怎样优化啊?
参数配置如下:
-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日志如下,求大神看看应该怎样优化啊?
出现这个问题的原因是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.