Tomcat的JreMemoryLeakPreventionListener监听周期性频繁执行full gc

昨天下午公司有个后台管理系统,部署后,今天早上观察来看,发现gc.log中频繁的执行full gc,活动轨迹很明确, 都是一个小时执行一次整个空间的full gc,但明显内存占用率还远远没有达到阈值,从日志上可以明确判断出应该是执行System.gc后导致的,因此回忆了下,貌似记得Tomcat的server.xml中有一个防止内存溢出的JreMemoryLeakPreventionListener监听,这个监听器每小时就会执行一次full gc操作。

GC日志如下:

2014-12-30T17:58:35.403+0800: 1.346: [GC [PSYoungGen: 11796K->1600K(688128K)] 11796K->1600K(1998848K), 0.0079880 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2014-12-30T17:58:35.412+0800: 1.354: [Full GC (System) [PSYoungGen: 1600K->0K(688128K)] [ParOldGen: 0K->1533K(1310720K)] 1600K->1533K(1998848K) [PSPermGen: 9890K->9881K(21248K)], 0.1058880 secs] [Times: user=0.10 sys=0.00, real=0.10 secs] 
2014-12-30T18:58:35.523+0800: 3601.466: [GC [PSYoungGen: 448564K->6578K(688128K)] 450097K->8111K(1998848K), 0.0310010 secs] [Times: user=0.03 sys=0.00, real=0.03 secs] 
2014-12-30T18:58:35.555+0800: 3601.497: [Full GC (System) [PSYoungGen: 6578K->0K(688128K)] [ParOldGen: 1533K->7148K(1310720K)] 8111K->7148K(1998848K) [PSPermGen: 27454K->27270K(47040K)], 0.2429830 secs] [Times: user=0.32 sys=0.01, real=0.24 secs] 
2014-12-30T19:58:35.803+0800: 7201.746: [GC [PSYoungGen: 108961K->448K(688128K)] 116109K->7596K(1998848K), 0.0059280 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-30T19:58:35.809+0800: 7201.752: [Full GC (System) [PSYoungGen: 448K->0K(688128K)] [ParOldGen: 7148K->6779K(1310720K)] 7596K->6779K(1998848K) [PSPermGen: 27298K->27295K(49728K)], 0.1770710 secs] [Times: user=0.27 sys=0.00, real=0.18 secs] 
2014-12-30T20:58:35.992+0800: 10801.935: [GC [PSYoungGen: 115014K->416K(688128K)] 121794K->7195K(1998848K), 0.0020870 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-30T20:58:35.994+0800: 10801.937: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 6779K->6779K(1310720K)] 7195K->6779K(1998848K) [PSPermGen: 27318K->27316K(49152K)], 0.1771080 secs] [Times: user=0.21 sys=0.00, real=0.17 secs] 
2014-12-30T21:58:36.178+0800: 14402.120: [GC [PSYoungGen: 108961K->384K(688128K)] 115740K->7163K(1998848K), 0.0020450 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-30T21:58:36.180+0800: 14402.123: [Full GC (System) [PSYoungGen: 384K->0K(688128K)] [ParOldGen: 6779K->6779K(1310720K)] 7163K->6779K(1998848K) [PSPermGen: 27348K->27346K(48128K)], 0.1427490 secs] [Times: user=0.22 sys=0.00, real=0.14 secs] 
2014-12-30T22:58:36.328+0800: 18002.271: [GC [PSYoungGen: 115014K->384K(688128K)] 121794K->7163K(1998848K), 0.0043360 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-30T22:58:36.332+0800: 18002.275: [Full GC (System) [PSYoungGen: 384K->0K(688128K)] [ParOldGen: 6779K->6779K(1310720K)] 7163K->6779K(1998848K) [PSPermGen: 27369K->27367K(46912K)], 0.1630450 secs] [Times: user=0.23 sys=0.00, real=0.16 secs] 
2014-12-30T23:58:36.502+0800: 21602.445: [GC [PSYoungGen: 108961K->416K(688128K)] 115740K->7195K(1998848K), 0.0020590 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-30T23:58:36.505+0800: 21602.447: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 6779K->6779K(1310720K)] 7195K->6779K(1998848K) [PSPermGen: 27388K->27386K(45184K)], 0.1414310 secs] [Times: user=0.18 sys=0.00, real=0.14 secs] 
2014-12-31T00:58:36.651+0800: 25202.594: [GC [PSYoungGen: 272102K->1936K(688128K)] 278881K->8715K(1998848K), 0.0063670 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2014-12-31T00:58:36.658+0800: 25202.600: [Full GC (System) [PSYoungGen: 1936K->0K(688128K)] [ParOldGen: 6779K->7989K(1310720K)] 8715K->7989K(1998848K) [PSPermGen: 28948K->28828K(44160K)], 0.1725180 secs] [Times: user=0.26 sys=0.00, real=0.16 secs] 
2014-12-31T01:58:36.837+0800: 28802.780: [GC [PSYoungGen: 108961K->448K(688128K)] 116950K->8437K(1998848K), 0.0028360 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T01:58:36.840+0800: 28802.783: [Full GC (System) [PSYoungGen: 448K->0K(688128K)] [ParOldGen: 7989K->7911K(1310720K)] 8437K->7911K(1998848K) [PSPermGen: 28837K->28835K(42624K)], 0.1597730 secs] [Times: user=0.25 sys=0.00, real=0.15 secs] 
2014-12-31T02:58:37.006+0800: 32402.949: [GC [PSYoungGen: 184397K->576K(688128K)] 192308K->8487K(1998848K), 0.0040460 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] 
2014-12-31T02:58:37.010+0800: 32402.953: [Full GC (System) [PSYoungGen: 576K->0K(688128K)] [ParOldGen: 7911K->7914K(1310720K)] 8487K->7914K(1998848K) [PSPermGen: 28941K->28858K(41088K)], 0.1480620 secs] [Times: user=0.23 sys=0.00, real=0.14 secs] 
2014-12-31T03:58:37.166+0800: 36003.108: [GC [PSYoungGen: 108961K->416K(688128K)] 116875K->8330K(1998848K), 0.0015720 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T03:58:37.167+0800: 36003.110: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 7914K->7910K(1310720K)] 8330K->7910K(1998848K) [PSPermGen: 28881K->28879K(39872K)], 0.1586110 secs] [Times: user=0.24 sys=0.00, real=0.16 secs] 
2014-12-31T04:00:45.200+0800: 36131.142: [GC [PSYoungGen: 589824K->17981K(688128K)] 597734K->25891K(1998848K), 0.0268200 secs] [Times: user=0.06 sys=0.02, real=0.03 secs] 
2014-12-31T04:01:15.170+0800: 36161.113: [GC [PSYoungGen: 607805K->63779K(688128K)] 615715K->71689K(1998848K), 0.1363460 secs] [Times: user=0.44 sys=0.06, real=0.14 secs] 
2014-12-31T04:58:37.334+0800: 39603.276: [GC [PSYoungGen: 402679K->2319K(688128K)] 410589K->10229K(1998848K), 0.0068720 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T04:58:37.341+0800: 39603.283: [Full GC (System) [PSYoungGen: 2319K->0K(688128K)] [ParOldGen: 7910K->9191K(1310720K)] 10229K->9191K(1998848K) [PSPermGen: 35630K->35529K(48192K)], 0.2331910 secs] [Times: user=0.34 sys=0.00, real=0.24 secs] 
2014-12-31T05:58:37.579+0800: 43203.521: [GC [PSYoungGen: 51182K->384K(688128K)] 60374K->9575K(1998848K), 0.0021830 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T05:58:37.581+0800: 43203.524: [Full GC (System) [PSYoungGen: 384K->0K(688128K)] [ParOldGen: 9191K->9040K(1310720K)] 9575K->9040K(1998848K) [PSPermGen: 35535K->35533K(46976K)], 0.2071250 secs] [Times: user=0.31 sys=0.00, real=0.21 secs] 
2014-12-31T06:58:37.792+0800: 46803.735: [GC [PSYoungGen: 49107K->416K(688128K)] 58147K->9456K(1998848K), 0.0020180 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T06:58:37.794+0800: 46803.737: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 9040K->9040K(1310720K)] 9456K->9040K(1998848K) [PSPermGen: 35537K->35535K(45760K)], 0.1882060 secs] [Times: user=0.28 sys=0.00, real=0.19 secs] 
2014-12-31T07:58:37.991+0800: 50403.933: [GC [PSYoungGen: 106007K->480K(688128K)] 115047K->9520K(1998848K), 0.0058040 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T07:58:37.997+0800: 50403.939: [Full GC (System) [PSYoungGen: 480K->0K(688128K)] [ParOldGen: 9040K->9044K(1310720K)] 9520K->9044K(1998848K) [PSPermGen: 35627K->35545K(44608K)], 0.2040780 secs] [Times: user=0.28 sys=0.00, real=0.20 secs] 
2014-12-31T08:58:38.206+0800: 54004.148: [GC [PSYoungGen: 49107K->416K(688128K)] 58151K->9460K(1998848K), 0.0028130 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T08:58:38.209+0800: 54004.151: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 9044K->9038K(1310720K)] 9460K->9038K(1998848K) [PSPermGen: 35556K->35554K(43520K)], 0.2127030 secs] [Times: user=0.30 sys=0.00, real=0.21 secs] 
2014-12-31T09:58:38.426+0800: 57604.368: [GC [PSYoungGen: 104450K->512K(688128K)] 113489K->9550K(1998848K), 0.0048270 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T09:58:38.431+0800: 57604.373: [Full GC (System) [PSYoungGen: 512K->0K(688128K)] [ParOldGen: 9038K->9043K(1310720K)] 9550K->9043K(1998848K) [PSPermGen: 35650K->35568K(42496K)], 0.2114120 secs] [Times: user=0.30 sys=0.00, real=0.21 secs] 
2014-12-31T10:58:38.649+0800: 61204.592: [GC [PSYoungGen: 72699K->416K(688128K)] 81743K->9459K(1998848K), 0.0031730 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
2014-12-31T10:58:38.652+0800: 61204.595: [Full GC (System) [PSYoungGen: 416K->0K(688128K)] [ParOldGen: 9043K->9064K(1310720K)] 9459K->9064K(1998848K) [PSPermGen: 35606K->35604K(41856K)], 0.2143140 secs]

 

网上还是有蛮多解决方案,还是说说我最比较喜欢且常用的吧,

1、添加gcDaemonProtection="false"参数禁用JreMemoryLeakPreventionListener监听。

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" gcDaemonProtection="false"/>

 

2、直接删除JreMemoryLeakPreventionListener监听。



已有 0 人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐
  • —软件人才免语言低担保 赴美带薪读研!—



你可能感兴趣的:(tomcat,监听)