Changes to Garbage Collection in JDK 12
Thomas Schatzl
thomas.schatzl at oracle.com
Wed Dec 19 15:03:04 UTC 2018
Hi all,
now that it's Christmas and JDK12 ramping down I would like to give
an overview of JDK12 changes to GC from the Oracle Hotspot GC team's
view that may impact end-users.
>From a statistics POV there have been 197 changes for this release in
GC so far [0], 70 bugs fixed, 124 enhancements, and 3 JEPs implemented.
As part of that there has been a significant increase in external
contributions in the last six months as you will see - that kept the
reviewers quite busy :)
Let's walk over a selection of improvements categorized by garbage
collector:
G1
- Abortable mixed collections (JEP 344 [1]) made it into JDK12 [2]:
this feature is intended to improve G1 meeting pause time goals when
incrementally collecting the old generation by incrementally collecting
old generation regions within a particular GC. More information about
this feature in last year's FOSDEM presentation [3]
- the changes for Promptly return unused committed memory from G1 (JEP
346 [4][5]) let G1 perform regular garbage collection cycles to give
back Java heap memory to the operating system if the system is idle.
This change has been initially suggested and contributed by Rodrigo B.
and Ruslan S. from JElastic.
- Kishor K. from Intel contributed changes to allow only the old
generation on alternate memory devices like NVDIMMs [6]. (Note that
this feature is technically still not in the release yet, but
requesting late commit, so it *might* still be moved off to next
release)
- G1 will now try to give back Java heap memory at every concurrent
marking cycle if normal heap sizing heuristics indicate so, e.g. -Xms
is smaller than -Xmx, there is a lot of excess free heap and others, as
opposed to require a full gc to do that [7].
- _all_ collectors use a new, more latency optimized way of terminating
a set of worker threads [8] contributed by RedHat, and generic
optimizations to the work stealing mechanism have been implemented [9].
This reduces pause times for all collectors, particularly when using
many threads.
- optimizations to G1 pause times: the usual bunch of micro-
optimizations for shorter pauses [10][11][12][13]. :)
- G1 adds a few more JFR events to make its contents closer to what you
can get from the logs [14].
ZGC
- ZGC added class unloading, and doing that concurrently to the
application at the same time [15]. :)
- some remaining parts of the ZGC pauses were parallelized or moved
into the concurrent phase to further decrease pause times [16][17]
- ZGC is now built and available, still as experimental, by default
[18]
Oracle JDK12 EA builds can already be downloaded right now from
http://jdk.java.net/12/ - please report issues here or at
https://bugreport.java.com/ to make the VM even better.
Thanks again to the many contributors who made this list of changes
possible, and stay tuned for JDK13+ GC changes :)
Have fun digging references, and enjoy!
Thanks,
Thomas
[0]
https://bugs.openjdk.java.net/browse/JDK-8215548?jql=project%20%3D%20JDK%20AND%20issuetype%20in%20(Bug%2C%20Enhancement)%20AND%20fixVersion%20in%20(%2212%22%2C%2012.0.1%2C%2012.0.2)%20AND%20component%20%3D%20hotspot%20AND%20Subcomponent%20%3D%20gc
[1] http://openjdk.java.net/jeps/344
[2] https://bugs.openjdk.java.net/browse/JDK-8213890
[3] https://archive.fosdem.org/2018/schedule/event/g1/
[4] http://openjdk.java.net/jeps/346
[5] https://bugs.openjdk.java.net/browse/JDK-8212657
[6] https://bugs.openjdk.java.net/browse/JDK-8202286
[7] https://bugs.openjdk.java.net/browse/JDK-6490394
[8] https://bugs.openjdk.java.net/browse/JDK-8204947
[9] https://bugs.openjdk.java.net/browse/JDK-8205921
[10] https://bugs.openjdk.java.net/browse/JDK-8212911
[11] https://bugs.openjdk.java.net/browse/JDK-8212753
[12] https://bugs.openjdk.java.net/browse/JDK-8211853
[13] https://bugs.openjdk.java.net/browse/JDK-8209843
[14] https://bugs.openjdk.java.net/browse/JDK-8196341
[15] https://bugs.openjdk.java.net/browse/JDK-8214897
[16] https://bugs.openjdk.java.net/browse/JDK-8210883
[17] https://bugs.openjdk.java.net/browse/JDK-8210064
[18] https://bugs.openjdk.java.net/browse/JDK-8214476
More information about the hotspot-gc-use
mailing list