Java 8 GC Tutorials - Herong's Tutorial Examples - v1.03, by Dr. Herong Yang
Parallel Collector Stops Application for Minor/Major GC
This section provides log messages showing that the Parallel Collector stops the application for both Minor GC and Major GC.
The next thing we confirm is stop-the-world behavior of the Parallel Collector. This can be verified with "-XX:+PrintGCApplicationStoppedTime" and "-XX:+PrintGCApplicationConcurrentTime" JVM options:
herong> \progra~1\java\jdk1.8.0\bin\java -Xms2m -Xmx64m -XX:+UseParallelGC \ -XX:+PrintGCDetails -XX:+PrintGCTimeStamps \ -XX:+PrintGCApplicationStoppedTime \ -XX:+PrintGCApplicationConcurrentTime \ GarbageCollection > output.txt (Ctrl-C) herong> more output.txt Step/TotalMemory/FreeMemory/UsedMemory: 0.735: Application time: 0.1749388 seconds 0.736: [GC (Allocation Failure) [PSYoungGen: 511K->248K(768K)] 1280... 0.740: [Full GC (Ergonomics) [PSYoungGen: 248K->238K(768K)] [ParOld... 0.755: Total time for which application threads were stopped: 0.0197849 seconds, Stopping threads took: 0.0000875 seconds 1 3145728 1821016 1324712 1.760: Application time: 1.0048803 seconds 1.760: [GC (Allocation Failure) [PSYoungGen: 748K->248K(768K)] 2189... 1.768: [Full GC (Ergonomics) [PSYoungGen: 248K->0K(768K)] [ParOldGe... 1.786: Total time for which application threads were stopped: 0.0255083 seconds, Stopping threads took: 0.0001301 seconds 2 5505024 3124776 2380248 2.776: Application time: 0.9903883 seconds 2.776: [GC (Allocation Failure) [PSYoungGen: 474K->224K(768K)] 3156... 2.783: Total time for which application threads were stopped: 0.0064196 seconds, Stopping threads took: 0.0001250 seconds 3 5505024 2045928 3459096 3.791: Application time: 1.0084043 seconds 3.791: [GC (Allocation Failure) [PSYoungGen: 695K->240K(1024K)] 414... 3.798: Total time for which application threads were stopped: 0.0065890 seconds, Stopping threads took: 0.0001242 seconds ...
As we can see from the output:
Conclusion: The Parallel collector does stop the application completely (stop-the-world) for both minor GC and major GC.
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"
Parallel Collector GC Log Message Format
"-XX:+PrintGCTaskTimeStamps" - Print GC Threads
"-XX:ParallelGCThreads=n" - # of Threads
►Parallel Collector Stops Application for Minor/Major GC
PSYoungGen Collector Using Tenuring Age
Parallel Collector Changing NewRatio and SurvivorRatio
Parallel Collector Adaptive Size Policy
Adaptive Size Policy Log Messages
"-XX:+PrintAdaptiveSizePolicy" - Minor GC Report
Adaptive Size Policy Changed Survivor Space
Adaptive Size Policy Changed Eden Space
Adaptive Size Policy for Best Latency
Adaptive Size Policy for Best Throughput
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