4

I am using Java 11 and using G1GC. The application that I am working on is a big data application, and the weird thing that I am noticing is that I am monitoring the application for 24 hours, and there is no major GC. But the size of Old gen is going down again and again periodically, and coincidently it is happening when minor GC is taking a lot of time at the same minute.
I am not able to understand why spikes on minor GC are clearing out data from Old gen.

1 Answers1

7

The G1 GC also has the concept of a Mixed GC which gives G1 GC its name - Garbage First. In this GC, the young generation is cleaned as well as a number of regions from the Old space that contain the most garbage, that is, Garbage First. This mechanism allows the G1 GC to attempt to avoid the Full GCs for as long as possible. As the full GCs are mainly responsible for the long pause time associated with garbage collections, the G1 GC is able to minimize the need for these expensive operations.

shaipraj
  • 121
  • 2
  • 1
    excellent answer and correct. just notice that there are parameters that allow you to instruct `G1` to how much to take into account for a mixed collection. – Eugene Apr 05 '21 at 16:49