Adaptive Size Policy Changed Eden Space

This section provides a tutorial on how Adaptive Size Policy used by the Parallel collector changed the eden space in the Young generation to meet the throughput goal.

In GC log example presented in the last tutorial, the Adaptive Size Policy of the Parallel collector suggested to keep Young generation size as is.

In this tutorial, we will look at GC log example from the test that suggests to change the survivor space size:

herong> java -Xms1200m -Xmx1200m -XX:+UseParallelGC -XX:NewRatio=1 \
   -XX:SurvivorRatio=1 -Xlog:gc=debug,gc+heap=debug,gc+ergo=trace \
   GarbageCollection2
...
1163   1048576000   802232232   246343768
[debug][gc,heap] GC(5) Heap before GC invocations=6 (full 0): PSYoungGen
                         total 409600K, used 240522K [...
[debug][gc,heap] GC(5)   eden space 204800K, 99% used [...
[debug][gc,heap] GC(5)   from space 204800K, 17% used [...
[debug][gc,heap] GC(5)   to   space 36352K, 0% used [...
[debug][gc,heap] GC(5)  ParOldGen       total 614400K, used 48K [...
[debug][gc,heap] GC(5)   object space 614400K, 0% used [...

[trace][gc,ergo] GC(5) AdaptiveSizePolicy::minor_collection_end:
                        minor gc cost: 0.303590  average: 0.221932
[trace][gc,ergo] GC(5)  minor pause: 9.540876 minor period 21.885927
[trace][gc,ergo] GC(5) AdaptiveSizePolicy::update_averages:
                        survived: 36586064  promoted: 8192  overflow: false
[debug][gc,ergo] GC(5) AdaptiveSizeStart:  collection: 6
[trace][gc,ergo] GC(5) old_gen_capacity: 629145600
                        young_gen_capacity: 246939648
[trace][gc,ergo] GC(5) avg_survived: 36091504.000000
                        avg_deviation: 377959.750000
[debug][gc,ergo] GC(5) avg_survived_padded_avg: 37225384.000000
[trace][gc,ergo] GC(5) avg_promoted_avg: 9575.137695
                        avg_promoted_dev: 1991.718140
[debug][gc,ergo] GC(5) avg_promoted_padded_avg: 15550.291992
                        avg_pretenured_padded_avg: 0.000000
            tenuring_thresh: 5  target_size: 37748736
[trace][gc,ergo] GC(5) PSAdaptiveSizePolicy::adjust_eden_for_throughput
                        (is_full: 0, cur_eden: 209715200):
            mutator_cost 0.778068  major_gc_cost 0.000000
            minor_gc_cost 0.221932
[trace][gc,ergo] GC(5) Scaled eden increment: 209715200 by 1.000000
                        down to 209715200

[trace][gc,ergo] GC(5) Adjusting eden for throughput
                         (avg 0.778068 goal 0.990000).
                         desired_eden_size 419430400 eden delta 209715200
   -- Suggested to increase "eden" space to improve throughput

[debug][gc,ergo] GC(5) PSAdaptiveSizePolicy::compute_eden_space_size limits:
                         desired_eden_size: 419430400
             old_eden_size: 209715200
             eden_limit: 382205952 cur_eden: 209715200
             max_eden_size: 382205952 avg_young_live: 36091504
[debug][gc,ergo] GC(5) PSAdaptiveSizePolicy::compute_eden_space_size:
                         costs minor_time: 0.221932 major_cost: 0.000000
             mutator_cost: 0.778068 throughput_goal: 0.990000

[trace][gc,ergo] GC(5) Minor_pause: 0.010203 major_pause: 0.000000
                        minor_interval: 0.124147 major_interval: 0.000000
            pause_goal: 18446744073709552.000000
[debug][gc,ergo] GC(5) Live_space: 304526976 free_space: 419430400
[trace][gc,ergo] GC(5) Base_footprint: 268435456 avg_young_live: 36091504
                        avg_old_live: 0
[debug][gc,ergo] GC(5) Old eden_size: 209715200
                        desired_eden_size: 382205952
[trace][gc,ergo] GC(5) PSAdaptiveSizePolicy::check_gc_overhead_limit:
                        promo_limit: 629145600 max_eden_size: 382205952
            total_free_limit: 1011351552
            max_old_gen_size: 629145600
            max_eden_size: 382205952 mem_free_limit: 20227031
[trace][gc,ergo] GC(5) PSYoungGen::resize_spaces
                        (requested_eden_size: 382205952,
             requested_survivor_size: 37748736)
[trace][gc,ergo] GC(5)     eden: [0xda800000..0x0e7000000) 209715200
[trace][gc,ergo] GC(5)     from: [0xfdc80000..0x100000000) 37224448
[trace][gc,ergo] GC(5)       to: [0xe7000000..0x0f3800000) 209715200
[trace][gc,ergo] GC(5)   Eden, to, from:
[trace][gc,ergo] GC(5)    [eden_start .. eden_end):
                           [0xda800000 .. 0x0fb800000) 553648128
[trace][gc,ergo] GC(5)    [  to_start ..   to_end):
                           [0xfb800000 .. 0x0fdc00000) 37748736
[trace][gc,ergo] GC(5)    [from_start .. from_end):
                           [0xfdc80000 .. 0x100000000) 37224448
   -- Increased "eden" space from 209715200 to 553648128

[trace][gc,ergo] GC(5) AdaptiveSizePolicy::survivor space sizes:
                        collection: 6 (37224448, 209715200)
             -> (37224448, 37748736)
[trace][gc,ergo] GC(5) Young generation size: desired eden: 382205952
                        survivor: 37748736 used: 36586064
            capacity: 590872576 gen limits: 629145600 / 629145600
[debug][gc,ergo] GC(5) AdaptiveSizeStop: collection: 6
[info ][gc,heap] GC(5) PSYoungGen: 240522K->35728K(577024K)
[info ][gc,heap] GC(5) ParOldGen: 48K->56K(614400K)
[info ][gc     ] GC(5) Pause Young (Allocation Failure)
                        234M->34M(1163M) 9.932ms

[debug][gc,heap] GC(5) Heap after GC invocations=6 (full 0): PSYoungGen
                        total 577024K, used 35728K [...
[debug][gc,heap] GC(5)   eden space 540672K, 0% used [...
[debug][gc,heap] GC(5)   from space 36352K, 98% used [...
[debug][gc,heap] GC(5)   to   space 36864K, 0% used [...
[debug][gc,heap] GC(5)  ParOldGen       total 614400K, used 56K [...
[debug][gc,heap] GC(5)   object space 614400K, 0% used [...

In this example, the "eden" space was increased based on the Adaptive Size Policy suggestion. It is trying to increase the application execution time to meet the throughput goal of 99%.

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