Garbage Collection, the visual difference from Java 8 and Java 11

Having a quick look at how the same application behaves under Java 8 and Java 11 we can see there's a noticeable difference in how GC works, this is due to the change in the default GC engine, as detailed below.

Here it is, visually represented thanks to VisualVM, the difference in how the two GC engines operate:



Java 11:




Starting from Java 9, the default garbage collector (GC) was changed from Parallel GC to G1 (see JEP 248). This change has performance implications, as described in the JEP motivation:

“Limiting GC pause times is, in general, more important than maximizing throughput. Switching to a low-pause collector such as G1 should provide a better overall experience, for most users, than a throughput-oriented collector such as the Parallel GC, which is currently the default.”

In other words, the Parallel GC is optimized for throughput at the expense of longer GC pauses, whereas the new default G1 GC is optimized for shorter GC pauses at the expense of lower throughput.

GigaSpaces benchmarking confirms this assertion. We evaluated GigaSpaces products with the following Java configurations and results:

  • Java 11 and no GC configuration: throughput is lower.
  • Java 11 and Parallel GC: throughput is the same as in systems using Java 8.
  • Java 8 and G1 GC: throughput is the same as in systems using Java 11 with the default GC.

Use the following Java options to explicitly set a garbage collector:

  • Parallel GC: -XX:+UseParallelGC
  • G1 GC: -XX:+UseG1GC

For more information about garbage collection in Java-based systems, see Oracle’s Garbage Collection Tuning Guide for Java 11.

Conclusion: When upgrading to Java 11, it is important to be aware of the new default GC mechanism, and to choose the one that best serves your application requirements. If your configuration already explicitly sets the GC mechanism, this GC will be the one used with Java 11.



Italian English French German Hungarian Slovenian


Nome: Andrea
Cognome: Schiffo
Data e luogo di nascita: 6/9/86 a S.Daniele del Friuli
Residenza: Ciconicco di Fagagna (UD) - Italy
Studi: Laurea Triennale in Informatica presso Uniud
Occupazione: QA Automation Engineer @ Xanadu
Interessi: CICLISMO!, tecnologia/comunicazione, informatica, cultura, volontariato

email andrea schiffo

Download CV

Follow me on:

See me also on...

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set. To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.
EU Cookie Directive plugin by