GCOverheadLimit support for G1

Sonia Zaldana Calles szaldana at redhat.com
Fri Jan 10 14:15:34 UTC 2025


Hi folks,

Upon migration from ParallelGC to G1, we have a report that G1 is
showcasing a slow death when too much time is spent in garbage collection,
in contrast to ParallelGC, which would trigger an “OutOfMemoryError: GC
Overhead limit exceeded”.

Note the single class reproducer below [0]. Running with java ... -Xlog:gc
-Xmx4G, we can observe long pauses (~3-4 seconds on my machine), the VM
attempts ~20 Full GC cycles where the last full GCs take a lot longer than
the pause time goal of 200ms. Ideally, we would like the JVM to stop trying
at some point early (similarly to ParallelGC) and we have not found a way
to accomplish that.

We found this is likely because UseGCOverheadLimit is only supported (and
enabled by default) for the ParallelGC. We came across JDK-8212084 and we
were wondering if there was a particular reason this didn’t move forward?
[1] Is there anything we can do to help?

[0]

import java.util.LinkedList;

public class GCOverheadReproducer {

  private static final LinkedList fixedData = new LinkedList();

  private static final int FIXED_DATA_ITEM_SIZE = 32;

  private static final int TEMPORARY_DATA_ITEM_SIZE = FIXED_DATA_ITEM_SIZE
/ 2 - 1;

  public static void main(String[] args) throws InterruptedException {

    System.out.println("Consuming all memory");

    while (true) {

      try {

        fixedData.add(new byte[FIXED_DATA_ITEM_SIZE]);

      } catch (OutOfMemoryError oome) {

        System.out.println(oome);

        System.out.printf("OOME triggered. Releasing %s bytes of
memory.\n", FIXED_DATA_ITEM_SIZE);

        fixedData.removeLast();

        break;

      }

    }

    System.out.println("Running allocate-release loop");

    while (true) {

      Object temporaryData = new byte[TEMPORARY_DATA_ITEM_SIZE];

    }

  }

}

[1] https://bugs.openjdk.org/browse/JDK-8212084

Thanks,

Sonia

-- 
Sonia Zaldaña Calles
Software Engineer, OpenJDK
Red Hat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20250110/4b42602d/attachment-0001.htm>


More information about the hotspot-gc-dev mailing list