1 year ago

#319434

test-img

Akash

Major GC not running in G1 to clear Old Gen Heap

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

java

garbage-collection

heap-memory

g1gc

0 Answers

Your Answer

Accepted video resources