Tag Archives: JDK

As I already mentioned in previous post I decided to perform microbenchmarks to figure out what GC settings are optimal for customer’s application. Unfortunately, I had faced with an unexpected problem: JDK documentation is very obscure in questions related to GC settings, for example, Java HotSpot VM Options states following:
it seems to be wrong because “-” (minus sign) before option means disabling corresponding option, but not enabling it 😦 Fortunately, I discovered two useful JVM options: -XX:+PrintFlagsFinal and -XX:+PrintCommandLineFlags, which allow to get information about enabled options and resulting commandline arguments, for example:

i.e. -XX:-UseParallelOldGC option disables parallel garbage collection for the full collections and parallel garbage collection for scavenges is enabled by default for my JVM. Also I found a nice blogpost which clarified a lot of my doubts. I slightly redrew the diagram provided in that post:
because connection between CMS and MSC GCs seems to be confusing, and now it’s clear that JVM supports seven combinations of GCs. For Java 6 these combinations are:

Short options

Long options

Description

-XX:+UseG1GC

-XX:+UseG1GC

Use G1 collector for young and tenured generations

-XX:+Parallel

-XX:+Parallel -XX:-UseParallelOldGC

Use Parallel Scavenge collector for young generation, and Serial for tenured

-XX:+UseConcMarkSweepGC

-XX:+UseConcMarkSweepGC -XX:+UseParNewGC

Use ParNew collector for young generation and CMS for tenured

-XX:+UseConcMarkSweepGC -XX:-UseParNewGC

-XX:+UseConcMarkSweepGC -XX:-UseParNewGC

Use Serial collector for young generation and CMS for tenured

-XX:+UseSerialGC

-XX:+UseSerialGC

Use Serial collector for young generation and Serial for tenured

-XX:+UseParNewGC

-XX:+UseParNewGC

Use ParNew collector for young generation and Serial for tenured

-XX:+UseParallelOldGC

-XX:+Parallel -XX:+UseParallelOldGC

Use Parallel Scavenge collector for young generation, and Parallel for tenured

In Java 7 -XX:+UseParallelOldGC option is enabled by default, so GC matrix for Java 7 differs by two rows.