Java GC Tutorials - Herong's Tutorial Examples - v1.12, by Herong Yang
Serial Collector Stops Application for Minor/Major GC
This section provides log messages showing that the Serial Collector stops the application for both Minor GC and Major GC.
One impact of using the Serial Collector is that it performs both Minor and Major collection in a stop-the-world fashion (application pause). But 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 Serial Collector.
However if you are still using JVM 8 or older releases, you can confirm stop-the-world behavior of the Serial Collector with "-XX:+PrintGCApplicationStoppedTime" and "-XX:+PrintGCApplicationConcurrentTime" JVM options:
herong> \Progra~1\java\jdk1.8.0\bin\java -Xms2m -Xmx64m -XX:+PrintGC -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCTimeStamps -XX:+UseSerialGC GarbageCollection Step/TotalMemory/FreeMemory/UsedMemory: 0.114: Application time: 0.0088216 seconds -- Application executed for 0.0088216 seconds with no stop 0.115: [GC (Allocation Failure) 878K->755K(1984K), 0.0017072 secs] -- Serial Collector did a Minor GC 0.117: Total time for which application threads were stopped: 0.0025561 s, Stopping threads took: 0.0000456 seconds -- Serial Collector did stop the application for 0.0025561 seconds 1 2031616 698704 1332912 1.109: Application time: 0.9924986 seconds -- Application executed for 0.9924986 seconds with no stop 1.110: [GC (Allocation Failure) 1557K->1540K(2500K), 0.0054299 secs] 1.117: [Full GC (Allocation Failure) 1540K->1540K(2500K), 0.0052930 secs] -- Serial Collector did a Major (labeled as Full) GC 1.123: Total time for which application threads were stopped: 0.0135217 s, Stopping threads took: 0.0000990 seconds -- Serial Collector did stop the application for 0.0135217 seconds 2 3874816 1473136 2401680 2.128: Application time: 1.0044262 seconds -- Application executed for 1.0044262 seconds with no stop 2.130: [GC (Allocation Failure) 2601K->2580K(3784K), 0.0047073 secs] -- Serial Collector did a Minor GC 2.135: Total time for which application threads were stopped: 0.0064456 s, Stopping threads took: 0.0001472 seconds -- Serial Collector did stop the application for 0.0064456 seconds 3 3874816 425272 3449544 3.131: Application time: 0.9955077 seconds -- Application executed for 1.9955077 seconds with no stop 3.133: [GC (Allocation Failure) 3624K->3620K(4820K), 0.0055259 secs] 3.139: [Full GC (Allocation Failure) 3620K->3620K(4820K), 0.0057639 secs] -- Serial Collector did a Major (labeled as Full) GC 3.146: Total time for which application threads were stopped: 0.0136471 s, Stopping threads took: 0.0001502 seconds -- Serial Collector did stop the application for 0.0136471 seconds ...
The GC log messages confirm that:
Table of Contents
Heap Memory Area and Size Control
JVM Garbage Collection Logging
Introduction of Garbage Collectors
►Serial Collector - "+XX:+UseSerialGC"
GC Log Message Format for Serial Collector
GC Log Message Examples of Serial Collector
Log Message Types from Serial Collector
►Serial Collector Stops Application for Minor/Major GC
Usage Report on Heap Memory Areas
Default NewRatio - Old vs. New Generation
"-XX:NewRatio" - Ratio of Tenured and "new" Generation
"-XX:SurvivorRatio" - Ratio of Eden and Survivor Space
Serial GC Tracing - Tight Heap
Serial GC Tracing - Tight Heap (Part 2)
Serial GC Tracing - Tight Heap (Part 3)
Serial GC Tracing - Plenty of Heap
Serial GC Tracing - Aged Live Objects
Serial GC Tracing - Tenuring Threshold
"-XX:TargetSurvivorRatio" - Second Tenuring Condition
Serial GC Tracing - Tenuring Threshold Controlled
"-XX:+NeverTenure" and "-XX:+AlwaysTenure" Working
Minor GC Triggering Condition of Serial Collector
Parallel Collector - "+XX:+UseParallelGC"
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