Parallel GC is a parallel stop-the-world collector, which means that when a GC occurs, it stops all application threads and performs the GC work using multiple threads.
One difference is that G1 is a compacting collector. Also, G1 offers more predictable garbage collection pauses than the CMS collector, and allows users to specify desired pause targets. As with CMS, G1 is designed for applications that require shorter GC pauses.
Concurrent mode reduces the overall time spent in GC because the mark phase for 2nd generation happens in dedicated thread in parallel with application threads. In this mode, GC suspends user threads for shorter amount of time but will use slightly more memory.
GC Implementations JVM has five types of GC implementations: Serial Garbage Collector. Parallel Garbage Collector. CMS Garbage Collector.
Since the document you linked was for a 1.4.2 VM that's what I'll assume you're using (JVMs 5 and 6 behave differently).
From http://java.sun.com/docs/hotspot/gc1.4.2/
if -XX:+UseConcMarkSweepGC is used on the command line then the flag UseParNewGC is also set to true if it is not otherwise explicitly set on the command line
So the answer is you only need to use -XX:+UseConcMarkSweepGC and it will enable the concurrent collector with the parallel young generation collector.
Edit: for Java 6, the same flag (-XX:+UseConcMarkSweepGC) enables the concurrent collector. The choice of collector you want depends on a few things, and you should test different configurations. But there are some very general guidelines. If you have a single processor, single thread machine then you should use the serial collector (default for some configurations, can be enabled explicitly for with -XX:+UseSerialGC). For multiprocessor machines where your workload is basically CPU bound, use the parallel collector. This is enabled by default if you use the -server flag, or you can enable it explicitly with -XX:+UseParallelGC. If you'd rather keep the GC pauses shorter at the expense of using more total CPU time for GC, and you have more than one CPU, you can use the concurrent collector (-XX:+UseConcMarkSweepGC). Note that the concurrent collector tends to require more RAM allocated to the JVM than the serial or parallel collectors for a given workload because some memory fragmentation can occur.
java/JDK 6 GC tuning : http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html. This is from SUN (now Oracle). The full stuff.
Also, see
http://kirk.blog-city.com/is_your_concurrent_collector_failing_you.htm
http://www.javaperformancetuning.com/
This blog entry has a nice breakdown of the different collectors, and which options are valid: http://blogs.oracle.com/jonthecollector/entry/our_collectors
Java GC tuning is basically a dark art, but in my application (runs with a 50+GB heap, and 16 physical cores) the ConcMarkSweep collector resulted in a 3x speedup over the -server default, and a 2.2x speedup over ParallelOldGC.
If you aren't sharing the machine with other processes (so idle cores are just wasted) use the ConcMarkSweepGC.
ParNew is the default young generation collector when CMS is used.You just have to specify -XX:+UseConcMarkSweepGC to use CMS and ParNew will be used by default. CMS is a good collector if avoiding GC jitters is of higher priority but if throughput is more important for eg for a batch like job the default SUN parallel collector does a better job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With