FYI: Changes to Garbage Collection in JDK11
thomas.schatzl at oracle.com
Wed Jun 20 15:03:06 UTC 2018
now that JDK11 is mostly wrapped up from a new feature point of view
of the Oracle Hotspot GC team I thought it would be useful to give an
overview and rough impact of these changes for end-users :)
Given my search in JIRA , overall there have been 280 changes to the
gc subcomponent, 203 of them were enhancements within the last 6 month
period so far.
Until GA there will probably be a few more, but already it looks like a
significant release for GC :)
Here we go with a selection of changes:
- scalability improvements to G1 parallel Full GC .
- decrease G1 remembered set overhead significanlty by maintaining
remembered sets only as needed .
Some numbers were reported in this year's FOSDEM presentation about G1
. Next to significantly reducing remembered set overhead, in some
cases even in the range of two magnitudes, this change improves
throughput and pause times, but may lengthen the concurrent phase.
G1's adaptive determination of the start of the phase can handle this,
but if you manually set the so-called IHOP you might experience full-
Due to these changes the Cleanup pause is now very fast too, typically
in the range of a few milliseconds. This is due to removal of the now
unnecessary "Scrub Remembered Sets" part.
- G1 frees memory that has become completely empty more eagerly
(earlier) during the marking cycle. Instead of waiting for the Cleanup
pause, all memory is released during the Remark pause. 
This may relieve some memory pressure in your application.
- the G1 Object Copy phase has been changed to better exploit caching
effects . This results in significant lower GC pause times (and may
decrease memory use during GC a lot) on all architectures.
- Processing of java.lang.ref.Reference objects ("Reference
Processing") has been overhauled completely. All collectors are
affected and hopefully improved. I wrote another email to this list 
recently for details.
- Parallel and G1 GC object copy pause were improved significantly on
more weakly ordered architectures (I think ARM*/PPC*) by using more
lightweight synchronization  
- all collectors size the number of GC worker threads according to heap
size by making -XX:+UseDynamicNumberOfGCThreads default . For this
reason we also tweaked the sizing policy a bit .
In case you are running applications on very small heaps on large
machines you may experience slight throughput regressions since by
default GC uses less threads on such heaps.
However at the same time, startup and resource usage is greatly
- there is no closed GC code any more. All functionality of the GCs of
the the formerly "closed" JDK has been made open or removed.
- Metaspace fragmentation and memory usage has been reduced
significantly for all collectors .
- the Z garbage collector is available as an experimental option .
ZGC aims to have very low pause times (<10ms) on any kind of heap or
live-set size, trading some throughput for it. There is an extensive
wiki  for more information, and a video from JFokus .
- great work has been done in the internals of the GC code to make it
more maintainable and extendable in the future. While this does not
have direct impact to end users, this for example allowed us to add two
more experimental garbage collectors 
Since most people in the industry are still on JDK8, I would like to
point out that overall, with G1, compared to JDK8 it is possible to get
60% lower pause times "for free" on x64 processors (probably more on
ARM/PPC due to mentioned specific changes), at a highly reduced memory
So please consider giving JDK 11 a try - you can already download EAs
with almost all of above changes right now from http://jdk.java.net/11/
- and report issues here or at https://bugreport.java.com/ to make it
Thanks to everyone that made this possible, and stay tuned for JDK12+
GC changes :)
Have fun digging the references, and enjoy JDK 11,
More information about the hotspot-gc-use