Adaptive Size Policy Changed Survivor Space

This section provides a tutorial on how Adaptive Size Policy used by the Parallel collector changed the survivor space in the Young generation.

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:NewRatio=1 -XX:SurvivorRatio=1 \
    -XX:+UseParallelGC -Xlog:gc=debug,gc+heap=debug,gc_ergo=trace \
1461   1205862400   854657656   351204744
[debug][gc,heap] GC(4) Heap before GC invocations=5 (full 0): PSYoungGen
                         total 358400K, used 342933K [...
[debug][gc,heap] GC(4)   eden space 307200K, 99% used [...
[debug][gc,heap] GC(4)   from space 51200K, 69% used [...
[debug][gc,heap] GC(4)   to   space 51200K, 0% used [...
[debug][gc,heap] GC(4)  ParOldGen       total 819200K, used 40K [...
[debug][gc,heap] GC(4)   object space 819200K, 0% used [...

[trace][gc,ergo] GC(4) AdaptiveSizePolicy::minor_collection_end:
                       minor gc cost: 0.231551  average: 0.179291
[trace][gc,ergo] GC(4)   minor pause: 7.582323 minor period 25.163547
[trace][gc,ergo] GC(4) AdaptiveSizePolicy::update_averages:
                       survived: 36635168  promoted: 0  overflow: false

[debug][gc,ergo] GC(4) AdaptiveSizeStart:  collection: 5
[trace][gc,ergo] GC(4) old_gen_capacity: 838860800
                       young_gen_capacity: 367001600
[trace][gc,ergo] GC(4) avg_survived: 36638520.000000
                       avg_deviation: 11309.248047
[debug][gc,ergo] GC(4) avg_survived_padded_avg: 36672448.000000
[trace][gc,ergo] GC(4) avg_promoted_avg: 8200.192383
                       avg_promoted_dev: 2222.899414
[debug][gc,ergo] GC(4) avg_promoted_padded_avg: 14868.890625
                         avg_pretenured_padded_avg: 0.000000
             tenuring_thresh: 6  target_size: 36700160
   -- Suggested to set tenuring threshold to 6
   -- Suggested to set survivor space to 36700160

[trace][gc,ergo] GC(4) PSAdaptiveSizePolicy::adjust_eden_for_throughput
                       (is_full: 0, cur_eden: 314572800):
             mutator_cost 0.820709  major_gc_cost 0.000000
             minor_gc_cost 0.179291
[trace][gc,ergo] GC(4) Scaled eden increment: 314572800 by 1.000000
                       down to 314572800
[trace][gc,ergo] GC(4) Adjusting eden for throughput
                       (avg 0.820709 goal 0.990000).
             desired_eden_size 629145600 eden delta 314572800
[debug][gc,ergo] GC(4) PSAdaptiveSizePolicy::compute_eden_space_size
                       limits: desired_eden_size: 629145600
             old_eden_size: 314572800 eden_limit: 314572800
             cur_eden: 314572800 max_eden_size: 314572800
             avg_young_live: 36638520
[debug][gc,ergo] GC(4) PSAdaptiveSizePolicy::compute_eden_space_size:
                       costs minor_time: 0.179291 major_cost: 0.000000
             mutator_cost: 0.820709 throughput_goal: 0.990000
[trace][gc,ergo] GC(4) Minor_pause: 0.010463 major_pause: 0.000000
                       minor_interval: 0.163884 major_interval: 0.000000
             pause_goal: 18446744073709552.000000
[debug][gc,ergo] GC(4) Live_space: 305073984 free_space: 629145600
[trace][gc,ergo] GC(4) Base_footprint: 268435456
                       avg_young_live: 36638520 avg_old_live: 0
[debug][gc,ergo] GC(4) Old eden_size: 314572800
                       desired_eden_size: 314572800
[trace][gc,ergo] GC(4) PSAdaptiveSizePolicy::check_gc_overhead_limit:
                       promo_limit: 838860800 max_eden_size: 314572800
             total_free_limit: 1153433600
             max_old_gen_size: 838860800
             max_eden_size: 314572800 mem_free_limit: 23068672
[trace][gc,ergo] GC(4) PSYoungGen::resize_spaces(
                        requested_eden_size: 314572800,
            requested_survivor_size: 36700160)
[trace][gc,ergo] GC(4)   eden: [0xe7000000..0x0f9c00000) 314572800
[trace][gc,ergo] GC(4)   from: [0xf9c00000..0x0fce00000) 52428800
[trace][gc,ergo] GC(4)    to: [0xfce00000..0x100000000) 52428800
[trace][gc,ergo] GC(4) Eden, from, to:
[trace][gc,ergo] GC(4)  [eden_start .. eden_end):
                         [0xe7000000 .. 0x0f9c00000) 314572800
[trace][gc,ergo] GC(4)  [from_start .. from_end):
                         [0xf9c00000 .. 0x0fce00000) 52428800
[trace][gc,ergo] GC(4)  [  to_start ..   to_end):
                         [0xfdd00000 .. 0x100000000) 36700160
   -- Reduced survivor "to" space from 52428800 to 36700160

[trace][gc,ergo] GC(4) AdaptiveSizePolicy::survivor space sizes:
                         collection: 5 (52428800, 52428800)
             -> (52428800, 36700160)
   -- Confirmed survivor space size changes

[trace][gc,ergo] GC(4) Young generation size:
                         desired eden: 314572800 survivor: 36700160
              used: 36635168
             capacity: 367001600
              gen limits: 419430400 / 419430400
[debug][gc,ergo] GC(4) AdaptiveSizeStop: collection: 5

[info ][gc,heap] GC(4) PSYoungGen: 342933K->35776K(358400K)
[info ][gc,heap] GC(4) ParOldGen: 40K->40K(819200K)
[info ][gc     ] GC(4) Pause Young (Allocation Failure)
                       334M->34M(1150M) 7.942ms

[debug][gc,heap] GC(4) Heap after GC invocations=5 (full 0): PSYoungGen
                         total 358400K, used 35776K [...
[debug][gc,heap] GC(4)   eden space 307200K, 0% used [...
[debug][gc,heap] GC(4)   from space 51200K, 69% used [...
[debug][gc,heap] GC(4)   to   space 35840K, 0% used [...
[debug][gc,heap] GC(4)  ParOldGen       total 819200K, used 40K [...
[debug][gc,heap] GC(4)   object space 819200K, 0% used [...

   PSAdaptiveSizePolicy::compute_eden_space_size limits:
      desired_eden_size: 419430400 old_eden_size: 209715200
      eden_limit: 209715200 cur_eden: 209715200
      max_eden_size: 209715200 avg_young_live: 18728788
   -- Suggested to increase "eden" to 419430400

As you can see, the "to" survivor space was decreased from 51200K to 35840K based on the Adaptive Size Policy suggestion. May be it is trying to lower the Minor GC time and increase Major GC time.

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