1

We use corretto java and using G1 gc.

As far as I know, the gc algorithms do halts the application while doing full gc for sometime not while young generation as it happens more frequently.

But some of articles mentioned that G1 gc halts the application in young generation too at the beginning of the GC to do some quick bookkeeping before it immediately resumes the application. Is it true ? Because during this time our health check failed and our Auto scaling group triggered scale out event.

Is it true that G1 gc in young generation halts the application ?

Selvakumar Ponnusamy
  • 5,363
  • 7
  • 40
  • 78
  • Are you using, or have you tried using, `-XX:G1PeriodicGCInterval`? – Kaan Jun 26 '22 at 17:55
  • We use Java 11, I think `XX:G1PeriodicGCInterval` can be used in above Java 12 – Selvakumar Ponnusamy Jun 27 '22 at 04:37
  • Dang, ok. More info available about that flag [here](https://docs.oracle.com/en/java/javase/17/gctuning/garbage-first-g1-garbage-collector1.html#GUID-DA6296DD-9AAB-4955-8B5B-683651936155). From Amazon's [product page](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc), corretto is available for OpenJDK 17 and 18 – maybe an option to consider going to a newer, post-11 version. – Kaan Jun 27 '22 at 16:56

2 Answers2

2

G1 Young phase includes two stop-the-world steps (marking and cleanup). It also includes some steps (Concurrent Start) which are concurrent.

So I would answer your question: yes, Young Collection halts/stop-the-world your application.

You can check G1 specifics here

usuario
  • 2,132
  • 1
  • 10
  • 26
1

I think this talk from Gil Tene is really useful: https://vimeo.com/374755640 Around 45:30 they start classifying common (legacy) collectors including G1 GC which they describe as:

enter image description here

Juraj Martinka
  • 3,991
  • 2
  • 23
  • 25