Major GC 未在 G1 中运行以清除 Old Gen Heap

发布于 2025-01-16 10:11:35 字数 3572 浏览 0 评论 0原文

JVM 使用 G1 GC,Old Gen 堆不断增加,我已经离开应用程序 5 天,下面是堆使用情况 -

jstat -gcutil   1
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT   
  0.00 100.00  43.27  72.98  96.98  89.46   7870   42.034     0    0.000     6    0.033   42.066
    JVM version is 11.0.14.1+1
    using thread-local object allocation.
    Garbage-First (G1) GC with 8 thread(s)
    
    Heap Configuration:
       MinHeapFreeRatio         = 40
       MaxHeapFreeRatio         = 70
       MaxHeapSize              = 1342177280 (1280.0MB)
       NewSize                  = 1363144 (1.2999954223632812MB)
       MaxNewSize               = 805306368 (768.0MB)
       OldSize                  = 5452592 (5.1999969482421875MB)
       NewRatio                 = 2
       SurvivorRatio            = 8
       MetaspaceSize            = 21807104 (20.796875MB)
       CompressedClassSpaceSize = 1073741824 (1024.0MB)
       MaxMetaspaceSize         = 17592186044415 MB
       G1HeapRegionSize         = 1048576 (1.0MB)
    
    Heap Usage:
    G1 Heap:
       regions  = 1280
       capacity = 1342177280 (1280.0MB)
       used     = 469777800 (448.01502227783203MB)
       free     = 872399480 (831.984977722168MB)
       35.00117361545563% used
    G1 Young Generation:
    Eden Space:
       regions  = 106
       capacity = 842006528 (803.0MB)
       used     = 111149056 (106.0MB)
       free     = 730857472 (697.0MB)
       13.20049813200498% used
    Survivor Space:
       regions  = 4
       capacity = 4194304 (4.0MB)
       used     = 4194304 (4.0MB)
       free     = 0 (0.0MB)
       100.0% used
    G1 Old Generation:
       regions  = 340
       capacity = 495976448 (473.0MB)
       used     = 354434440 (338.01502227783203MB)
       free     = 141542008 (134.98497772216797MB)
       71.46194974161354% used

在手动触发 Full GC 时,Old Gen 堆正在被清除。我尝试了下面的命令来触发 Full GC ->

jmap -clstats 1

JVM version is 11.0.14.1+1

using thread-local object allocation.
Garbage-First (G1) GC with 8 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 1342177280 (1280.0MB)
   NewSize                  = 1363144 (1.2999954223632812MB)
   MaxNewSize               = 805306368 (768.0MB)
   OldSize                  = 5452592 (5.1999969482421875MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 1048576 (1.0MB)

Heap Usage:
G1 Heap:
   regions  = 1280
   capacity = 1342177280 (1280.0MB)
   used     = 304937040 (290.8106231689453MB)
   free     = 1037240240 (989.1893768310547MB)
   22.719579935073853% used
G1 Young Generation:
Eden Space:
   regions  = 218
   capacity = 846200832 (807.0MB)
   used     = 228589568 (218.0MB)
   free     = 617611264 (589.0MB)
   27.01363073110285% used
Survivor Space:
   regions  = 0
   capacity = 0 (0.0MB)
   used     = 0 (0.0MB)
   free     = 0 (0.0MB)
   0.0% used
G1 Old Generation:
   regions  = 78
   capacity = 495976448 (473.0MB)
   used     = 76347472 (72.81062316894531MB)
   free     = 419628976 (400.1893768310547MB)
   15.393366420495838% used

每次触发 Full GC 时,内存都会被清除,并且我只能看到 15% 的堆在使用中。所以看起来没有内存泄漏。我还进行了堆转储并在不同的点进行了分析。我还没有发现任何大物体。

请帮助我如何从这里继续,是否需要任何 GC 微调? 目前我们仅使用以下 GC 参数 -

-Xms1280M -Xmx1280M -XX:+UseG1GC

谢谢

JVM uses G1 GC, Old Gen heap is increasing continuously, I have left my application for 5 days and below is the heap usage -

jstat -gcutil   1
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT   
  0.00 100.00  43.27  72.98  96.98  89.46   7870   42.034     0    0.000     6    0.033   42.066
    JVM version is 11.0.14.1+1
    using thread-local object allocation.
    Garbage-First (G1) GC with 8 thread(s)
    
    Heap Configuration:
       MinHeapFreeRatio         = 40
       MaxHeapFreeRatio         = 70
       MaxHeapSize              = 1342177280 (1280.0MB)
       NewSize                  = 1363144 (1.2999954223632812MB)
       MaxNewSize               = 805306368 (768.0MB)
       OldSize                  = 5452592 (5.1999969482421875MB)
       NewRatio                 = 2
       SurvivorRatio            = 8
       MetaspaceSize            = 21807104 (20.796875MB)
       CompressedClassSpaceSize = 1073741824 (1024.0MB)
       MaxMetaspaceSize         = 17592186044415 MB
       G1HeapRegionSize         = 1048576 (1.0MB)
    
    Heap Usage:
    G1 Heap:
       regions  = 1280
       capacity = 1342177280 (1280.0MB)
       used     = 469777800 (448.01502227783203MB)
       free     = 872399480 (831.984977722168MB)
       35.00117361545563% used
    G1 Young Generation:
    Eden Space:
       regions  = 106
       capacity = 842006528 (803.0MB)
       used     = 111149056 (106.0MB)
       free     = 730857472 (697.0MB)
       13.20049813200498% used
    Survivor Space:
       regions  = 4
       capacity = 4194304 (4.0MB)
       used     = 4194304 (4.0MB)
       free     = 0 (0.0MB)
       100.0% used
    G1 Old Generation:
       regions  = 340
       capacity = 495976448 (473.0MB)
       used     = 354434440 (338.01502227783203MB)
       free     = 141542008 (134.98497772216797MB)
       71.46194974161354% used

On manually trigger of Full GC, the Old Gen heap is getting cleared. I tried below command to trigger Full GC ->

jmap -clstats 1

JVM version is 11.0.14.1+1

using thread-local object allocation.
Garbage-First (G1) GC with 8 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 1342177280 (1280.0MB)
   NewSize                  = 1363144 (1.2999954223632812MB)
   MaxNewSize               = 805306368 (768.0MB)
   OldSize                  = 5452592 (5.1999969482421875MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 1048576 (1.0MB)

Heap Usage:
G1 Heap:
   regions  = 1280
   capacity = 1342177280 (1280.0MB)
   used     = 304937040 (290.8106231689453MB)
   free     = 1037240240 (989.1893768310547MB)
   22.719579935073853% used
G1 Young Generation:
Eden Space:
   regions  = 218
   capacity = 846200832 (807.0MB)
   used     = 228589568 (218.0MB)
   free     = 617611264 (589.0MB)
   27.01363073110285% used
Survivor Space:
   regions  = 0
   capacity = 0 (0.0MB)
   used     = 0 (0.0MB)
   free     = 0 (0.0MB)
   0.0% used
G1 Old Generation:
   regions  = 78
   capacity = 495976448 (473.0MB)
   used     = 76347472 (72.81062316894531MB)
   free     = 419628976 (400.1893768310547MB)
   15.393366420495838% used

Each time when I trigger the Full GC the memory gets cleared, and only 15% heap I can see in usage. So it seems that there is no memory leak. I have also took heap dumps and analyzed them at various points. I have not found any big objects.

Please help me how to proceed from here, is there any GC fine tuning required ?
Currently we are using only below params for GC -

-Xms1280M -Xmx1280M -XX:+UseG1GC

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文