Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146436

Add -XX:-ShrinkHeapInSteps option (previously -XX:+UseAggressiveHeapShrink)

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Subcomponent:
      gc

      Description

      [Note after filing this bug, it was decided to call the option ShrinkHeapInSteps instead of UseAggressiveHeapShrink, and give it the opposite meaning]

      Add -XX:+UseAggressiveHeapShrink option. With this option enabled after the next full GC the Java heap will be resized immediately to target size without requiring multiple GCs.

      This is useful for customers that want to minimize the amount of memory used by the java heap, and are willing to sacrifice some performance (induce more frequent GCs) to save that memory. When heap usage fluctuates greatly, the GC will tend to hold on to the excess heap memory longer than needed due to the the current algorithm which requires 4 full GCs before MaxHeapFreeRatio is fully honored. +UseAggressiveHeapShrink will eliminate the need to wait for 4 full GCs.

        Issue Links

          Activity

          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/7e1a36ca23d6
          User: cjplummer
          Date: 2016-03-22 00:51:46 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/7e1a36ca23d6 User: cjplummer Date: 2016-03-22 00:51:46 +0000
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/7e1a36ca23d6
          User: lana
          Date: 2016-04-20 17:53:12 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/7e1a36ca23d6 User: lana Date: 2016-04-20 17:53:12 +0000
          Hide
          cwayne Clifford Wayne added a comment -
          Raymond added this option to the Tools Ref Guide:

          On 1/9/17 12:42 PM, Raymond Gallardo wrote:

              Hi Chris,

              I updated the sections ShrinkHeapInSteps. Could you please review them?

              =========================

              http://st-doc.us.oracle.com/id_common/review/docbuilder/html/E61612_01/java.htm

              -XX:+ShrinkHeapInSteps
              Incrementally reduces the Java heap to the target size, specified by MaxHeapFreeRatio. This option is enabled by default. If disabled, it immediately reduces the Java heap to the target size instead of requiring multiple garbage collection cycles. Disable this option if you want to minimize the Java heap size. You will likely encounter performance degradation when this option is disabled.

              See Performance Tuning Examples for a description of using MaxHeapFreeRatio to keep the Java heap small by reducing the dynamic footprint for embedded applications.
          Show
          cwayne Clifford Wayne added a comment - Raymond added this option to the Tools Ref Guide: On 1/9/17 12:42 PM, Raymond Gallardo wrote:     Hi Chris,     I updated the sections ShrinkHeapInSteps. Could you please review them?     =========================      http://st-doc.us.oracle.com/id_common/review/docbuilder/html/E61612_01/java.htm     -XX:+ShrinkHeapInSteps     Incrementally reduces the Java heap to the target size, specified by MaxHeapFreeRatio. This option is enabled by default. If disabled, it immediately reduces the Java heap to the target size instead of requiring multiple garbage collection cycles. Disable this option if you want to minimize the Java heap size. You will likely encounter performance degradation when this option is disabled.     See Performance Tuning Examples for a description of using MaxHeapFreeRatio to keep the Java heap small by reducing the dynamic footprint for embedded applications.
          Hide
          cwayne Clifford Wayne added a comment -
          Raymond also updated the GC doc with content for the new option:

          On 1/31/17 1:20 PM, Raymond Gallardo wrote:
          >
          > Hi Chris,
          >
          >
          >
          > Thanks for the feedback; I modified the paragraph as follows:
          >
          >
          >
          > http://st-doc.us.oracle.com/id_common/review/docbuilder/html/E76294_01/factors-affecting-garbage-collection-performance.htm#GUID-7FB2D1D5-D75F-4AA1-A3B1-4A17F8FF97D0
          >
          >
          >
          > Minimize Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. Lowering MaxHeapFreeRatio to as low as 10% and MinHeapFreeRatio to 5% has successfully reduced the heap size without too much performance regression; however, results may vary greatly depending on your application. Try different values for these parameters until they are as low as possible yet still retain acceptable performance.
          >
          >
          >
          > Thanks,
          >
          > --Raymond
          >
          >
          >
          > From: Chris Plummer
          > Sent: January 27, 2017 1:01 PM
          > To: Raymond Gallardo
          > Cc: Clifford Wayne
          > Subject: Re: Documentation for -XX:-ShrinkHeapInSteps
          >
          >
          >
          > Hi Raymond,
          >
          > Sorry about the delay. Overall it looks good, but I still mentioning the 5%/10% numbers as examples might good guidance. For example:
          >
          > "Minimize Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. 10% for MaxHeapFreeRatio and 5% for MinHeapFreeRatio has been successfully used to aggressively shrink the heap size with out too much performance regression, but results may very greatly depending on your application. Try different values for these parameters until they are as low as possible yet still retain acceptable performance."
          >
          > thanks,
          >
          > Chris
          Show
          cwayne Clifford Wayne added a comment - Raymond also updated the GC doc with content for the new option: On 1/31/17 1:20 PM, Raymond Gallardo wrote: > > Hi Chris, > > > > Thanks for the feedback; I modified the paragraph as follows: > > > > http://st-doc.us.oracle.com/id_common/review/docbuilder/html/E76294_01/factors-affecting-garbage-collection-performance.htm#GUID-7FB2D1D5-D75F-4AA1-A3B1-4A17F8FF97D0 > > > > Minimize Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. Lowering MaxHeapFreeRatio to as low as 10% and MinHeapFreeRatio to 5% has successfully reduced the heap size without too much performance regression; however, results may vary greatly depending on your application. Try different values for these parameters until they are as low as possible yet still retain acceptable performance. > > > > Thanks, > > --Raymond > > > > From: Chris Plummer > Sent: January 27, 2017 1:01 PM > To: Raymond Gallardo > Cc: Clifford Wayne > Subject: Re: Documentation for -XX:-ShrinkHeapInSteps > > > > Hi Raymond, > > Sorry about the delay. Overall it looks good, but I still mentioning the 5%/10% numbers as examples might good guidance. For example: > > "Minimize Java heap size by lowering the values of the parameters MaxHeapFreeRatio (default value is 70%) and MinHeapFreeRatio (default value is 40%) with the command-line options -XX:MaxHeapFreeRatio and -XX:MinHeapFreeRatio. 10% for MaxHeapFreeRatio and 5% for MinHeapFreeRatio has been successfully used to aggressively shrink the heap size with out too much performance regression, but results may very greatly depending on your application. Try different values for these parameters until they are as low as possible yet still retain acceptable performance." > > thanks, > > Chris
          Hide
          cwayne Clifford Wayne added a comment -
          Added comments to address the changes needed in two docs effected.
          Show
          cwayne Clifford Wayne added a comment - Added comments to address the changes needed in two docs effected.

            People

            • Assignee:
              cjplummer Chris Plummer
              Reporter:
              cjplummer Chris Plummer
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: