- Loading...
Shenandoah is an ultra-low pause time garbage collector that reduces GC pause times by performing more garbage collection work concurrently with the running Java program. CMS and G1 both perform concurrent marking of live objects. Shenandoah adds concurrent compaction.
| Table of Contents | ||
|---|---|---|
|
Shenandoah is under development. There are several ways to try it:
Build the bleeding edge from the JDK 9 source. This would guarantee you run the latest and greatest version. Adding --enable-debug to configure would produce the "fastdebug" build.
| Code Block | ||
|---|---|---|
| ||
$ hg clone http://hg.openjdk.java.net/shenandoah/jdk9 shenandoah-jdk9 $ cd shenandoah-jdk9/ $ sh ./get_source.sh $ sh ./configure $ make images $ build/linux-x86_64-normal-server-release/images/jdk/bin/java -XX:+UseShenandoahGC -Xlog:gc [...][info][gc] Using Shenandoah |
Build the JDK 8 backport: same as above, but change "jdk9" to "jdk8u" in the paths above. The advantage is that you don't need to figure out JDK 9 compatibility issues for your application first (although it is a good idea to try JDK 9 now anyway). The downside is, that forest may easily be several months behind the JDK 9 version. If you encounter trouble with JDK 8 version, please try JDK 9 version.
| Code Block | ||
|---|---|---|
| ||
$ hg clone http://hg.openjdk.java.net/shenandoah/jdk8u shenandoah-jdk8u $ cd shenandoah-jdk8u/ $ sh ./get_source.sh $ sh ./configure $ make images $ build/linux-x86_64-normal-server-release/j2sdk-image/bin/java -XX:+UseShenandoahGC -version openjdk version "1.8.0-internal" OpenJDK Runtime Environment (build 1.8.0-internal-shade_2016_12_19_15_52-b00) OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode) |
Pick up the binary build from AdoptOpenJDK (jdk8, jdk9 – look at the publish dates, the builds might be outdated), or others (e.g. builds.shipilev.net).
Fedora 24/25:
| Code Block | ||
|---|---|---|
| ||
$ cat /etc/redhat-release Fedora release 25 (Twenty Five) $ java -XX:+UseShenandoahGC -version OpenJDK 64-Bit Server VM warning: Compressed Oops not supported with ShenandoahGC openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-b16) OpenJDK 64-Bit Server VM (build 25.111-b16, mixed mode) |
Gentoo ebuilds for IcedTea have Shenandoah USE flag.
Shenandoah is the regionalized collector, it maintains the heap as the collection of regions.
The regular Shenandoah GC cycle looks like this:
| Code Block | ||
|---|---|---|
| ||
GC(3) Pause Init Mark 1.142ms GC(3) Concurrent marking 7388M->7624M(8192M) 373.087ms GC(3) Pause Final Mark 7624M->2832M(8192M) 10.923ms GC(3) Concurrent evacuation 2836M->3224M(8192M) 115.076ms GC(3) Pause Init Update Refs 0.028ms GC(3) Concurrent update references 3224M->3424M(8192M) 210.427ms GC(3) Pause Final Update Refs 3424M->956M(8192M) 1.150ms GC(3) Concurrent reset bitmaps 956M->956M(8192M) 0.143ms |
The phases above do roughly this:
Heuristics tell when Shenandoah starts the GC cycle, and regions it marks for collection. Heuristics can be enabled with -XX:ShenandoahGCHeuristics=<name>. Some heuristics accept configuration parameters, which might help to tailor the GC operation to your use case better. Available heuristics include:
-XX:ShenandoahFreeThreshold=#: Set the percentage of free heap at which a GC cycle is started
-XX:ShenandoahAllocationThreshold=#: Set percentage of memory allocated since last GC cycle before a new GC cycle is started
-XX:ShenandoahInitFreeThreshold=#: Initial remaining free threshold
-XX:ShenandoahMinFreeThreshold=#: Minimum remaining free threshold
-XX:ShenandoahMaxFreeThreshold=#: Maximum remaining free threshold
-XX:ShenandoahHappyCyclesThreshold=#: How many successful marking cycles before improving free threshold
-XX:ShenandoahGarbageThreshold=#: Sets the percentage of garbage a region need to contain before it can be marked for collection.
In some cycles, Update References phase is merged with Concurrent Marking phase, at heuristics discretion. You can forcefully enable/disable Update References with -XX:ShenandoahUpdateRefsEarly=[on|off].
This section describes the ways one can diagnose and/or debug Shenandoah.
Basic configuration and command line options:
Approaches for debugging:
Bug reports are welcome at the mailing list.
This section describes the approaches to test and diagnose performance behaviors with Shenandoah.
Basic configuration and command line options:
It is almost always a good idea to run with -Xlog:gc -Xlog:gc+ergo -Xlog:gc+stats for testing.
Approaches to performance analysis:
Resources
Shenandoah is an ultra-low pause time garbage collector that reduces GC pause times by performing more garbage collection work concurrently with the running Java program. CMS and G1 both perform concurrent marking of live objects. Shenandoah adds concurrent compaction.
| Table of Contents | ||
|---|---|---|
|
Shenandoah is under development. There are several ways to try it:
Build the bleeding edge from the JDK 9 source. This would guarantee you run the latest and greatest version. Adding --enable-debug to configure would produce the "fastdebug" build.
| Code Block | ||
|---|---|---|
| ||
$ hg clone http://hg.openjdk.java.net/shenandoah/jdk9 shenandoah-jdk9
$ cd shenandoah-jdk9/
$ sh ./get_source.sh
$ sh ./configure
$ make images
$ build/linux-x86_64-normal-server-release/images/jdk/bin/java -XX:+UseShenandoahGC -Xlog:gc
[...][info][gc] Using Shenandoah
|
Build the JDK 8 backport: same as above, but change "jdk9" to "jdk8u" in the paths above. The advantage is that you don't need to figure out JDK 9 compatibility issues for your application first (although it is a good idea to try JDK 9 now anyway). The downside is, that forest may easily be several months behind the JDK 9 version. If you encounter trouble with JDK 8 version, please try JDK 9 version.
| Code Block | ||
|---|---|---|
| ||
$ hg clone http://hg.openjdk.java.net/shenandoah/jdk8u shenandoah-jdk8u
$ cd shenandoah-jdk8u/
$ sh ./get_source.sh
$ sh ./configure
$ make images
$ build/linux-x86_64-normal-server-release/j2sdk-image/bin/java -XX:+UseShenandoahGC -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-shade_2016_12_19_15_52-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode) |
Pick up the binary build from AdoptOpenJDK (jdk8, jdk9 – look at the publish dates, the builds might be outdated), or others (e.g. builds.shipilev.net).
Fedora 24/25:
| Code Block | ||
|---|---|---|
| ||
$ cat /etc/redhat-release
Fedora release 25 (Twenty Five)
$ java -XX:+UseShenandoahGC -version
OpenJDK 64-Bit Server VM warning: Compressed Oops not supported with ShenandoahGC
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b16)
OpenJDK 64-Bit Server VM (build 25.111-b16, mixed mode) |
Gentoo ebuilds for IcedTea have Shenandoah USE flag.
Shenandoah is the regionalized collector, it maintains the heap as the collection of regions.
The regular Shenandoah GC cycle looks like this:
| Code Block | ||
|---|---|---|
| ||
GC(3) Pause Init Mark 1.142ms
GC(3) Concurrent marking 7388M->7624M(8192M) 373.087ms
GC(3) Pause Final Mark 7624M->2832M(8192M) 10.923ms
GC(3) Concurrent evacuation 2836M->3224M(8192M) 115.076ms
GC(3) Pause Init Update Refs 0.028ms
GC(3) Concurrent update references 3224M->3424M(8192M) 210.427ms
GC(3) Pause Final Update Refs 3424M->956M(8192M) 1.150ms
GC(3) Concurrent reset bitmaps 956M->956M(8192M) 0.143ms |
The phases above do roughly this:
Init Mark initiates the concurrent marking. It prepares the heap and application threads for concurrent mark, and then scans the root set. This is a pause, and the most dominant consumer is the root set scan.
Heuristics tell when Shenandoah starts the GC cycle, and regions it marks for collection. Heuristics can be enabled with -XX:ShenandoahGCHeuristics=<name>. Some heuristics accept configuration parameters, which might help to tailor the GC operation to your use case better. Available heuristics include:
passive. This heuristics tells GC to be completely passive. Once memory runs out, the Full STW GC would be triggered. This heuristics is used for functional testing, but sometimes it is useful for bisecting performance anomalies with GC barriers.-XX:ShenandoahFreeThreshold=#: Set the percentage of free heap at which a GC cycle is started
-XX:ShenandoahAllocationThreshold=#: Set percentage of memory allocated since last GC cycle before a new GC cycle is started
-XX:ShenandoahInitFreeThreshold=#: Initial remaining free threshold
-XX:ShenandoahMinFreeThreshold=#: Minimum remaining free threshold
-XX:ShenandoahMaxFreeThreshold=#: Maximum remaining free threshold
-XX:ShenandoahHappyCyclesThreshold=#: How many successful marking cycles before improving free threshold
-XX:ShenandoahGarbageThreshold=#: Sets the percentage of garbage a region need to contain before it can be marked for collection.
In some cycles, Update References phase is merged with Concurrent Marking phase, at heuristics discretion. You can forcefully enable/disable Update References with -XX:
ShenandoahUpdateRefsEarlyThis section describes the ways one can diagnose and/or debug Shenandoah.
Basic configuration and command line options:
In many cases, running with fastdebug build will produce the meaningful assert messages, pointing at the earliest moment when GC detected the functional anomaly, and Shenandoah asserts a lot. These builds can be produced by adding --enable-debug to configure, and re-building.Approaches for debugging:
Put logging statements in the code around the failing assert to understand the issue better. With enough logging, you can retrace everything that happened in the collector.Bug reports are welcome at the mailing list.
This section describes the approaches to test and diagnose performance behaviors with Shenandoah.
Basic configuration and command line options:
Shenandoah performance, like the performance of almost all other GCs, depends on heap size. We expect it to perform better in cases when there is enough heap space to accommodate allocations while concurrent phases are running. The time for concurrent phases correlates with the live data set size (LDS) -- the space taken by live data. Therefore, the reasonable heap size is dependent on LDS in the workload: larger LDS-es require proportionally larger heap sizes. For some workloads with minuscule live data sets, 1...2 GB heaps performs well. We routinely test on 4...128 GB heaps on various workloads with up to 80% LDS size. Don't be shy to try different heap sizes to see what fits your workload.It is almost always a good idea to run with -Xlog:gc -Xlog:gc+ergo -Xlog:gc+stats for testing.
Approaches to performance analysis:
Some odd performance behaviors – like the allocation failure GCs, or long final marks – can be explained by heuristics issues. If you have a long-running workload, running under ShenandoahVisualizer would let you understand the high-level GC behavior. Sometimes the odd behavior is clearly visible there.Resources