我遇到tomcat 7 full gc频繁的问题
2016-08-22 10:29
507 查看
近日开始关注JVM的问题,先用jstat -gcutil pid随意看了一套web系统的JVM情况(容器是tomcat 7,jdk是1.7),结果非常惊讶,Full GC频繁,且周期性出现。
问题出现了,好兴奋啊,搞定它我就能增长经验了哇!!于是乎,和我们亲爱的SA同事交流了一番,我用nohup jstat -gccause pid 1s >> ~/xxx/xxx.log &先把gccause日志记录下来,经过半天日志记录追踪之后,发现LGCC是System.gc()。很好奇怎么会出现这东西,我写的代码肯定没有System.gc(),有点怀疑是tomcat的问题(当时也只是怀疑,无任何根据的)。为了解决这个问题,我先尝试在JVM启动参数中加入-XX:+DisableExplicitGC来禁止System.gc(),大半天后再用jstat看gc情况,FGC的次数是0,然后问题解决了。
虽然问题临时解决了,为了知其然知其所以然,我继续深究了一番,最终找到了问题所在:是tomcat 7的一个默认配置(JreMemoryLeakPreventionListener)所导致的,更合适的解决方法似乎是 <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" gcDaemonProtection="false"/>。
以下是引用的内容,原文网址在:http://mail-archives.apache.org/mod_mbox/tomcat-users/201008.mbox/%3CAANLkTino=BjP5LsBCwncB2HvNDzyKLr5y-8yWdt15a89@mail.gmail.com%3E
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) <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"
gcDaemonProtection="false"/>
4) Disable the listener altogether
We've decided to go with option 3.
问题出现了,好兴奋啊,搞定它我就能增长经验了哇!!于是乎,和我们亲爱的SA同事交流了一番,我用nohup jstat -gccause pid 1s >> ~/xxx/xxx.log &先把gccause日志记录下来,经过半天日志记录追踪之后,发现LGCC是System.gc()。很好奇怎么会出现这东西,我写的代码肯定没有System.gc(),有点怀疑是tomcat的问题(当时也只是怀疑,无任何根据的)。为了解决这个问题,我先尝试在JVM启动参数中加入-XX:+DisableExplicitGC来禁止System.gc(),大半天后再用jstat看gc情况,FGC的次数是0,然后问题解决了。
虽然问题临时解决了,为了知其然知其所以然,我继续深究了一番,最终找到了问题所在:是tomcat 7的一个默认配置(JreMemoryLeakPreventionListener)所导致的,更合适的解决方法似乎是 <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" gcDaemonProtection="false"/>。
以下是引用的内容,原文网址在:http://mail-archives.apache.org/mod_mbox/tomcat-users/201008.mbox/%3CAANLkTino=BjP5LsBCwncB2HvNDzyKLr5y-8yWdt15a89@mail.gmail.com%3E
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) <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"
gcDaemonProtection="false"/>
4) Disable the listener altogether
We've decided to go with option 3.
相关文章推荐
- 我遇到tomcat 7 full gc频繁的问题
- tomcat 7 full gc频繁问题
- 系统频繁Full gc问题分析及解决办法
- 系统频繁Full gc问题分析及解决办法
- JVM FULL GC太频繁,CPU占用率过高问题
- 运维中遇到的GC频繁告警问题处理方式
- 一次频繁Full GC问题排查过程分享
- 解决在Eclipse中配置JBoss、Tomcat等插件时遇到的问题
- tomcat频繁死掉的问题
- 使用Tomcat访问JSP页面时遇到的问题
- 解决在Eclipse中配置JBoss、Tomcat等插件时遇到的问题
- 解决在Eclipse中配置JBoss、Tomcat等插件时遇到的问题
- solaris下的tomcat遇到“java.io.IOException: 没有足够的空间”的问题
- tomcat 5.0配置error-page时遇到的小问题
- Spring+Hibernate+Struts项目中Tomcat常遇到的问题
- 重装Tomcat时遇到的问题
- tomcat遇到的Offending class的问题
- Eclipse 3.2 + lomboz + Tomcat 5.5 开发Struts 项目时遇到的问题
- MyEclipse+Tomcat 开发webServices中遇到的问题
- eclipes发布到tomcat时遇到的一点小问题