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 want to confirm is stop-the-world behavior of the Parallel Collector. There seems to be no easy way to do this in JVM 9 or higher releases. I could not find any "-Xlog" options to generate any log messages about when and for how long application gets stopped by the Parallel Collector.

But if you are still using JVM 8 or older releases, you can confirm stop-the-world behavior of the Parallel Collector 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

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

 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"

 What Is Parallel Collector

 Parallel Collector GC Log Message Format

 Log Message Types from Parallel Collector

 "--Xlog:gc+task+time=debug" - Print GC Threads

 "-XX:ParallelGCThreads" - # 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

 "-Xlog:gc+ergo=trace" - Minor GC Report

 Adaptive Size Policy Changed Survivor Space

 Adaptive Size Policy Changed Eden Space

 Adaptive Size Policy for Best Latency

 Parallel Collector Stopped using Young Generation

 Adaptive Size Policy for Best Throughput

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 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

 Garbage Collection Performance Test Summary

 References

 Full Version in PDF/EPUB