一次线上频繁full gc处理过程

1、引发时机:每次应用重启阶段,必定引发3次full gc

2、分析原因:启动时频繁full gc:一定是某个区的初始内存大小太小了,具体看gc日志,看看是哪个区空间不足引发的full gc

3、日志:

Java HotSpot(TM) 64-Bit Server VM (25.20-b23) for linux-amd64 JRE (1.8.0_20-b26), built on Jul 30 2014 13:13:52 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)

Memory: 4k page, physical 263562896k(78215956k free), swap 16777212k(10804080k free)

CommandLine flags: -XX:ErrorFile=/export/Instances/bingo-vis-global/server1/logs/java_error_%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/export/Instances/bingo-vis-global/server1/logs -XX:InitialHeapSize=1073741824 -XX:MaxHeapSize=1073741824 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UnlockExperimentalVMOptions -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 

2.554: [GC (Allocation Failure) [PSYoungGen: 262144K->43231K(305664K)] 262144K->43319K(1005056K), 0.1253627 secs] [Times: user=0.22 sys=0.04, real=0.12 secs] 

4.663: [GC (Allocation Failure) [PSYoungGen: 305375K->43498K(305664K)] 305463K->62009K(1005056K), 0.3960388 secs] [Times: user=0.65 sys=0.11, real=0.39 secs] 

6.351: [GC (Allocation Failure) [PSYoungGen: 305642K->43500K(305664K)] 324153K->96372K(1005056K), 0.8436135 secs] [Times: user=0.50 sys=1.18, real=0.85 secs] 

8.478: [GC (Allocation Failure) [PSYoungGen: 305644K->43498K(305664K)] 358516K->122337K(1005056K), 0.2072740 secs] [Times: user=0.27 sys=0.15, real=0.21 secs] 

12.167: [GC (Metadata GC Threshold) [PSYoungGen: 250384K->43517K(305664K)] 329224K->140543K(1005056K), 0.3096209 secs] [Times: user=0.45 sys=0.15, real=0.31 secs] 

12.477: [Full GC (Metadata GC Threshold) [PSYoungGen: 43517K->0K(305664K)] [ParOldGen: 97026K->58640K(699392K)] 140543K->58640K(1005056K), [Metaspace: 20758K->20758K(1069056K)], 0.7798582 secs] [Times: user=1.41 sys=0.12, real=0.78 secs] 

15.394: [GC (Allocation Failure) [PSYoungGen: 262144K->7339K(205312K)] 320784K->65988K(904704K), 0.0594347 secs] [Times: user=0.07 sys=0.05, real=0.06 secs] 

17.875: [GC (Allocation Failure) [PSYoungGen: 169131K->11653K(173568K)] 227780K->70310K(872960K), 0.2791850 secs] [Times: user=0.45 sys=0.02, real=0.28 secs] 

22.656: [GC (Allocation Failure) [PSYoungGen: 173445K->15604K(250880K)] 232102K->74269K(950272K), 0.2039588 secs] [Times: user=0.39 sys=0.04, real=0.20 secs] 

24.554: [GC (Metadata GC Threshold) [PSYoungGen: 99029K->12462K(251392K)] 157694K->72341K(950784K), 0.2042015 secs] [Times: user=0.45 sys=0.01, real=0.20 secs] 

24.759: [Full GC (Metadata GC Threshold) [PSYoungGen: 12462K->0K(251392K)] [ParOldGen: 59878K->45417K(699392K)] 72341K->45417K(950784K), [Metaspace: 34635K->34635K(1081344K)], 1.3014378 secs] [Times: user=2.49 sys=0.08, real=1.30 secs] 

32.153: [GC (Allocation Failure) [PSYoungGen: 153600K->26998K(254976K)] 199017K->72423K(954368K), 0.1028549 secs] [Times: user=0.11 sys=0.18, real=0.10 secs] 

46.360: [GC (Allocation Failure) [PSYoungGen: 184182K->34654K(251392K)] 229607K->80088K(950784K), 0.1106145 secs] [Times: user=0.24 sys=0.03, real=0.11 secs] 

62.183: [GC (Allocation Failure) [PSYoungGen: 191838K->25664K(262144K)] 237272K->71105K(961536K), 0.1721325 secs] [Times: user=0.29 sys=0.06, real=0.17 secs] 

90.180: [GC (Allocation Failure) [PSYoungGen: 198208K->26619K(259584K)] 243649K->72068K(958976K), 0.1733070 secs] [Times: user=0.35 sys=0.08, real=0.18 secs] 

102.164: [GC (Metadata GC Threshold) [PSYoungGen: 57034K->26444K(268288K)] 102483K->71902K(967680K), 0.1902910 secs] [Times: user=0.32 sys=0.13, real=0.19 secs] 

102.354: [Full GC (Metadata GC Threshold) [PSYoungGen: 26444K->0K(268288K)] [ParOldGen: 45457K->63242K(699392K)] 71902K->63242K(967680K), [Metaspace: 56817K->56703K(1101824K)], 1.9197108 secs] [Times: user=3.65 sys=0.11, real=1.92 secs]

 

4、日志分析:3次full gc,Metadata区域大小从默认初始的21M到32M再到56M,显然是Metadata区域的初始大小太小了

5、解决办法:添加jvm参数:-XX:+PrintGCDetails -Xloggc:/export/Logs/bingo_vis_cfg_jsf.jd.local/gc.log -XX:MetaspaceSize=128M

参考文献:https://blog.csdn.net/liubenlong007/article/details/78143285

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值