简体   繁体   English

G1GC - 如何检查巨大的对象是否是 GC 的瓶颈?

[英]G1GC - How to check if the humongous objects is a bottleneck in GC?

My Java application generated the following parts of logs:我的 Java 应用程序生成了以下部分日志:

[2022-04-15T08:30:22.722+0000][debug][gc,humongous      ] GC(1574) Live humongous region 926 object size 3914888 start 0x0000000673c00000  with remset 2 code roots 0 is marked 0 reclaim candidate 0 type array 1
[2022-04-15T08:30:22.722+0000][debug][gc,humongous      ] GC(1574) Live humongous region 942 object size 3913024 start 0x0000000675c00000  with remset 1 code roots 0 is marked 0 reclaim candidate 0 type array 1
[2022-04-15T08:30:22.722+0000][debug][gc,humongous      ] GC(1574) Live humongous region 944 object size 3912448 start 0x0000000676000000  with remset 2 code roots 0 is marked 0 reclaim candidate 0 type array 1
[2022-04-15T08:30:22.722+0000][debug][gc,humongous      ] GC(1574) Live humongous region 954 object size 3915320 start 0x0000000677400000  with remset 1 code roots 0 is marked 0 reclaim candidate 0 type array 1

From my understanding, it means the humongous regions are up to 954, if one region is taking 2mb then it's up to 2gb taken by the humongous regions.据我了解,这意味着巨大的区域最多为954,如果一个区域占用2mb,那么巨大的区域最多占用2GB。 Am I correct?我对么?

Is there any better way/tool of finding the humongous objects?有没有更好的方法/工具来寻找巨大的物体?

Answer my question:回答我的问题:

Live humongous region 926

It means the live humongous objects take 926 regions.这意味着活的巨大物体占据了 926 个区域。

object size 3915320

It means total humongous objects take 3,915,320(Byte)这意味着总巨大对象需要 3,915,320(Byte)

The humongous objects don't mean it's terrible.巨大的物体并不意味着它很糟糕。 Sometimes your application level cache might be kept in the old generation as humongous objects.有时,您的应用程序级缓存可能会作为巨大的对象保存在老一代中。

And after each GC, there's information on how many regions were freed:每次 GC 之后,都会显示释放了多少个区域的信息:

[<timestamp>][info ][gc,heap       ] GC(14) Eden regions: 111->0(1217)
[<timestamp>][info ][gc,heap       ] GC(14) Survivor regions: 12->11(16)
[<timestamp>][info ][gc,heap       ] GC(14) Old regions: 13->15
[<timestamp>][info ][gc,heap       ] GC(14) Humongous regions: 12->12

From this message, you can have an idea of how many humongous regions it used and decide if it needs to be tuned.从这条消息中,您可以了解它使用了多少个巨大的区域,并决定是否需要对其进行调整。

Source code: https://github.com/openjdk/jdk11u/blob/master/src/hotspot/share/gc/g1/g1CollectedHeap.cpp#L4537源代码: https://github.com/openjdk/jdk11u/blob/master/src/hotspot/share/gc/g1/g1CollectedHeap.cpp#L4537

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM