性能问答>CMS GC出现promotion failed问题>
5回复

CMS GC出现promotion failed问题


2020-02-17T14:04:55.599+0800: 2686448.171: [GC (Allocation Failure) 2020-02-17T14:04:55.600+0800: 2686448.172: [ParNew: 1796218K->48564K(1922432K), 0.0590711 secs] 2664187K->918040K(4019584K), 0.0595733 secs] [Times: user=0.14 sys=0.00, real=0.06 secs]
2020-02-17T14:05:04.260+0800: 2686456.832: [GC (Allocation Failure) 2020-02-17T14:05:04.260+0800: 2686456.832: [ParNew: 1796276K->56961K(1922432K), 0.0543414 secs] 2665752K->927708K(4019584K), 0.0710161 secs] [Times: user=0.12 sys=0.00, real=0.07 secs]
2020-02-17T14:05:11.650+0800: 2686464.222: [GC (GCLocker Initiated GC) 2020-02-17T14:05:11.651+0800: 2686464.223: [ParNew (promotion failed): 1625787K->1636356K(1922432K), 0.4093098 secs] 2723975K->2734544K(4019584K), 0.4098181 secs] [Times: user=0.56 sys=0.00, real=0.41 secs]
GC locker: Trying a full collection because scavenge failed
2020-02-17T14:05:12.060+0800: 2686464.632: [Full GC (GCLocker Initiated GC) 2020-02-17T14:05:12.061+0800: 2686464.632: [CMS: 1098188K->1253123K(2097152K), 3.3700918 secs] 2734544K->1253123K(4019584K), [Metaspace: 274632K->274620K(1308672K)], 3.3705341 secs] [Times: user=3.26 sys=0.10, real=3.37 secs]
2020-02-17T14:05:16.894+0800: 2686469.465: [GC (GCLocker Initiated GC) 2020-02-17T14:05:16.894+0800: 2686469.466: [ParNew (promotion failed): 1341016K->1388099K(1922432K), 0.3361973 secs] 3105882K->3152968K(4019584K), 0.3367343 secs] [Times: user=0.46 sys=0.03, real=0.33 secs]
GC locker: Trying a full collection because scavenge failed
2020-02-17T14:05:17.230+0800: 2686469.802: [Full GC (GCLocker Initiated GC) 2020-02-17T14:05:17.231+0800: 2686469.802: [CMS: 1764868K->1746410K(2097152K), 3.2179811 secs] 3152968K->1746410K(4019584K), [Metaspace: 274621K->274621K(1308672K)], 3.2184257 secs] [Times: user=2.93 sys=0.29, real=3.22 secs]

JVM参数:

-Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:MaxDirectMemorySize=1g -XX:SurvivorRatio=10 -XX:+UseConcMarkSweepGC -XX:CMSMaxAbortablePrecleanTime=5000 -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExplicitGCInvokesConcurrent -Dsun.rmi.dgc.server.gcInterval=2592000000 -Dsun.rmi.dgc.client.gcInterval=2592000000 -XX:ParallelGCThreads=4 -Xloggc:/home/admin/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps

应用正常run了一个月,突然出现FullGC耗时过长告警,观察GClog发现存在promotion failed错误,但是看上一次的YOUNG GC的堆内存前后大小好像挺正常的,老年代2GB总大小,用了才927708K-56961K = 850M,剩余50%+。

//上一次正常的youngGC
[ParNew: 1796276K->56961K(1922432K), 0.0543414 secs] 2665752K->927708K(4019584K), 0.0710161 secs]

我原先怀疑是老年代碎片化严重导致的,但是看这个日志
[ParNew (promotion failed): 1625787K->1636356K(1922432K), 0.4093098 secs]
剩余1.6GB晋升到老年代肯定是失败的,是因为存在超大对象等问题吗?还是别的问题?

还有为啥显示的年轻代单次GC后的大小比GC前还大?1625787K->1636356K

求大佬指点下。

6090 阅读
请先登录,查看5条精彩评论吧
快去登录吧,你将获得
  • 浏览更多精彩评论
  • 和开发者讨论交流,共同进步