tomcat 7 full gc频繁问题
2015-07-02 00:49
603 查看
链接:http://auzll.iteye.com/blog/1904081
近日开始关注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.
近日开始关注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.
相关文章推荐
- 解决:Linux下Java占用CPU突然升高,即使用空的tomcat也不会降低
- tomcat+java的web程序持续占cpu问题调试
- 部署Tomcat项目到外网
- Eclipse中启动tomcat报错java.lang.OutOfMemoryError: PermGen space的解决方法
- nginx+tomcat负载均衡
- Apache、Tomcat、Nginx
- 设置tomcat自启动时段
- tomcat配置默认访问工程目录
- JVM及Tomcat优化
- nginx+tomcat优化转载初步尝试流量项目
- 修改tomcat配置文件来改变访问路径
- myeclipse更改类或者是配置文件不用重启tomcat的方法
- tomcat登陆WEB显示无权限问题&& tomcat无限循环启动问题
- tomcat登陆WEB显示无权限问题&& tomcat无限循环启动问题
- jvm 内存溢出 在myeclipse中加大tomcat的jvm内存 java.lang.OutOfMemoryError: PermGen space
- 解决tomcat一闪而过(转)
- 关于tomcat 成功运行之后内存泄露
- (Win7 x64)NetBeans 8.0.2 使用Tomcat 8作为服务器
- 部署错误:尚未授予访问 Tomcat 服务器的权限。请在服务器管理器的 Tomcat 定制器中设置 "manager-script" 角色的正确用户名和口令。
- NetBeans启动Tomcat报'127.0.0.1' 不是内部或外部命令”启动失败