Parallel Collector Adaptive Size Policy

This section describes the Adaptive Size Policy supported by the Parallel Collector to dynamically change heap generation sizes to latency, throughput and footprint goals sequentially.

In the last tutorial, we observed that the Parallel collector dynamically changes Young generation size and survivor space ratio.

This behavior is actually a result of the "Adaptive Size Policy" used by the Parallel collector. Here is how it is described in Java documentation:

1. The "Adaptive Size Policy" is turned on by default with the Parallel collector ("-XX:+UseParallelGC" JVM option).

2. The "Adaptive Size Policy" can be turned on and off explicitly using -XX:+UseAdaptiveSizePolicy and "-XX:-UseAdaptiveSizePolicy" JVM options.

3. If it is turned on, the "Adaptive Size Policy" will change heap generation sizes dynamically to meet the following goals sequentially:

4. The "Adaptive Size Policy" uses the following simple approach to meet above goals:

5. The latency goal can be controlled by the "-XX:MaxGCPauseMillis=nnn" JVM option, where nnn specifies the number of milliseconds as the desired the application pause time. The default is "-XX:MaxGCPauseMillis=4294967295".

6. The throughput goal can be controlled by the "-XX:GCTimeRatio=nnn" JVM option, where nnn is used in a "1/(+nnn)" expression specifying the percentage of time for application GC pauses The default is "-XX:GCTimeRatio=99", which says 1% (or 1/(1+99)) of time should be used for application GC pauses.

7. The "-XX:AdaptiveSizePolicyOutputInterval=1" and "PrintAdaptiveSizePolicy" JVM options can be used to print out GC log messages on how Adaptive Size Policy was carried out at each GC.

The "Adaptive Size Policy" feature sounds great. We will test it out in the next tutorials.

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


 Full Version in PDF/EPUB