Java GC Tutorials - Herong's Tutorial Examples - v1.11, by Dr. Herong Yang
Parallel New (ParNew) Collector for Minor GC
This section demonstrates that the '-XX:+UseConcMarkSweepGC' JVM option invokes the Parallel New (ParNew) collector for Young generation GC.
In previous tutorials, we learned that the "-XX:+UseConcMarkSweepGC" JVM option invokes the "Parallel New (ParNew)" collector for Young generation GC and "Concurrent Mark-Sweep (CMS)" collector to Tenured generation GC.
In this tutorial, let's run our test with plenty of Young generation memory to see how ParNew collector works.
herong> java -Xms2m -Xmx64m -XX:+UseConcMarkSweepGC -Xms1200m -Xmx1200m \ -XX:NewRatio=1 -XX:SurvivorRatio=1 -Xlog:gc,gc+heap=info \ GarbageCollection > output.txt herong> more output.txt [info ][gc ] Using Concurrent Mark Sweep Step/TotalMemory/FreeMemory/UsedMemory: 1 1048576000 1040187352 8388648 ... 185 1048576000 838860800 209715200 [info ][gc,heap] GC(0) ParNew: 204800K->34034K(409600K) [info ][gc,heap] GC(0) CMS: 0K->0K(614400K) [info ][gc ] GC(0) Pause Young (Allocation Failure) 200M->33M(1000M) 14.555ms ... 372 1048576000 804009288 244566712 [info ][gc,heap] GC(1) ParNew: 238834K->37404K(409600K) [info ][gc,heap] GC(1) CMS: 0K->0K(614400K) [info ][gc ] GC(1) Pause Young (Allocation Failure) 233M->36M(1000M) 11.900ms ... 9874 1048576000 781730152 266845848 [info ][gc,heap] GC(51) ParNew: 259751K->61818K(409600K) [info ][gc,heap] GC(51) CMS: 840K->840K(614400K) [info ][gc ] GC(51) Pause Young (Allocation Failure) 254M->61M(1000M) 7.055ms
The output confirms that:
Table of Contents
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"
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
Maximum Logging of All Phases on Young GC
"-XX:ParallelGCThreads=6" - Young GC Parallel Threads
"-XX:MaxTenuringThreshold=0" - Tenuring Objects Immediately
"-XX:CMSInitiatingOccupancyFraction=20" - Initiate CMS
Maximum Logging of All Phases on Old GC
Maximum Logging of All Phases on Full GC
"-XX:ParallelGCThreads=6" - Old GC Parallel Threads
"-XX:ConcGCThreads=3" - Old GC Concurrent Threads
Garbage First (G1) Collector - "+XX:+UseG1GC"
The Z Garbage Collector (ZGC) - "+XX:+UseZGC"
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