RFC: JEP draft: Ergonomics Always Select the G1 Garbage Collector as Default

Thomas Schatzl thomas.schatzl at oracle.com
Wed Jun 25 08:46:40 UTC 2025


Hi,

On 25.06.25 06:30, Kirk Pepperdine wrote:
> Hi Thomas,
> 
> I believe I did mentioned that I have benchmarks that do better with the serial collector with smaller heaps. It isn’t an outright objection but more of another data point.

   are these applications available for public use in some kind of 
benchmark? Or can you categorize and describe them in some way that 
makes it possible to understand the issue.

Particularly with throughput, due to current barrier design, there can 
still be a substantial difference. The new write barriers that are very 
similar to Serial GC's improve these application's throughput a lot.

We are aware that in microbenchmarks (including literally the 
microbenchmarks provided in the JDK sources), G1's throughput will never 
match Serial's throughput due to G1's pre-write barrier (barring 
non-barrier related differences like e.g. reduced GC pauses/footprint 
due to eager reclaim, "better" generation sizing or such).

The advantages are improved latency (G1 avoids full gcs), and less 
confusion about what collector you actually get by default, including 
the need for comments/talks like "Serial is the actual default 
collector". Or surprised questions on the internet that somehow the user 
got Serial GC even after reading that G1 is the default collector.

We've also started working on the AHS for G1 JEP (and obviously the 
functionality), and these two changes synergize: they ease use in e.g. 
container environments. At least by default (no options selected), one 
can then run the VM in any (small to larger) container and it will also 
automatically size itself according to available memory.
That could also resolve the many sizing issues people have when starting 
out with containers.

There will be more internal in-depth performance testing before 
potentially flipping the switch.

As the JEP notes, Serial will not go away.

However to have a remote chance to get all this in for the next release 
(in the happy path), we need to work on the JEP early.

Hth improving your understanding,
   Thomas


More information about the hotspot-gc-dev mailing list