应用启动FGC频繁问题排查

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yangguosb/article/details/86716608

现象

  应用刚启动的几分钟内固定的发生3次FGC,之后平稳不再GC;

GC日志分析

  从GC日志可以看出,Metaspace容量达到上限分别触发了一次YGC和FGC,而且Metaspace容量的容量在变大这说明Metaspace容量在不断扩容,这说明Metaspace容量设置过小导致应用启动时发生了扩容,查看JVM参数发现没有显式指定Metaspace容量,默认为20M;
在这里插入图片描述

GCeasy可视化分析

  GCeasy的分析结果如下,可以看出Metadata GC耗时严重,给出的修改建议也是-XX:MetaspaceSize配置Metaspace容量;
在这里插入图片描述
在这里插入图片描述

名词解释

  • Metadata GC Threshold:This GC is triggered when Metaspace got filled up and JVM wants to create new objects in this space(Metaspace的容量达到设定的阈值,导致触发GC);
  • Allocation Failure:Allocation Failure happens when there isn’t enough free space to create new objects in Young generation. Allocation failures triggers Young GC. On Linux, the JVM can trigger a GC if the kernel notifies there isn’t much memory left via mem_notify(Young区空间不足导致对象分配失败触发YGC);

参考:

  1. gceasy网址:https://gceasy.io/diamondgc-report.jsp?oTxnId_value=f3d059e4-fd71-402c-a1a6-f4e7ce33c491

猜你喜欢

转载自blog.csdn.net/yangguosb/article/details/86716608