Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"
This chapter provides tutorial notes and example codes on the Concurrent Mark-Sweep Collector specified by the '+XX:+UseConcMarkSweepGC' JVM option. Topics include introduction to Concurrent Mark-Sweep (CMS) Collector; CMS Collector log message format; demonstration of reduction of stop-the-world by running parts of Mark and Sweep step concurrently with the application.
These sections are omitted from this Web preview version. To view the full content,
see information on how to obtain the full version this book.
What Is Concurrent Mark-Sweep (CMS) Collector
Concurrent Mark-Sweep Collector GC Log Message Format
Reduce Stop-The-World with Concurrent Mark and Sweep
Parallel New (ParNew) Collector for Minor GC
ParNew Collector - Tenuring Age Distribution
"-XX:MaxTenuringThreshold=0" - Tenuring Objects Immediately
"-XX:CMSInitiatingOccupancyFraction=20" - Initiate CMS
"concurrent mode failure" - CMS Cancelled
"-XX:PrintCMSStatistics=1" - Print CMS Threads Stats
CMS GC Phases and Threads
"-XX:ParallelGCThreads=2" - CMS Parallel Threads
"-XX:ConcGCThreads=3" - CMS Concurrent Threads
- The Concurrent Mark-Sweep (CMS) Collector, -XX:+UseConcMarkSweepGC, actually
uses the Parallel New (ParNew) Collector of the Young generation
and the Concurrent Mark Sweep (CMS) Collector of the Tenured generation.
- The CMS Collector uses "ParNew" to represent Young Generation GC
in log messages.
- The CMS Collector uses "CMS-concurrent-*" to represent Tenured Generation GC
in log messages.
- The CMS Collector performs Major GC with multiple threads concurrently
without stopping the application most of the time.
- Application is stopped by the CMS Collector for Initial Mark and Final Mark steps of Major GC.
- Application is stopped by the CMS Collector for Minor GC.
- The CMS collector is also called Low-Latency Collector,
because it reduces the application pause time. But it may slowdown the application,
because the GC is running concurrently with the application.
It's a good choice for interactive applications like Websites.
- ParNew collector is used to perform Young generation GC
when "-XX:+UseConcMarkSweepGC" option is used.
- ParNew maintains a Tenuring Age Distribution list to determine
object promotion to Tenured generation.
- Tenured generation occupancy percentage initiates the CMS GC.
- CMS Concurrent mode may fail, if Tenured generation gets fully
occupied before it can finish the GC process.
- The CMS collector does uses multiple threads for some phases in the GC process.
- The number of threads in CMS parallel phases can be controlled by the "-XX:ParallelGCThreads=n" option.
- The number of threads in 1 CMS concurrent phase, Mark phase, can be controlled by the "-XX:ConcGCThreads=n" option.
Table of Contents
About This Book
Heap Memory Area and Size Control
JVM Garbage Collection Logging
Introduction of Garbage Collectors
Serial Collector - "+XX:+UseSerialGC"
Parallel Collector - "+XX:+UseParallelGC"
►Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"
Garbage First (G1) Collector - "+XX:+UseG1GC"
Object References and Garbage Collection
Garbage Collection Performance Test Program
Performance Tests on Serial Collector
Performance Tests on Parallel collector
Performance Tests on Concurrent collector
Performance Tests on G1 collector
Garbage Collection Performance Test Summary
Full Version in PDF/EPUB