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

Implement adaptive sizing algorithm for IHOP



    • CSR
    • Status: Closed
    • P2
    • Resolution: Approved
    • 9
    • hotspot
    • None
    • gc
    • behavioral
    • minimal
    • add/remove/modify command line option
    • SE



      Provide adaptive sizing for the IHOP (InitiatingHeapOccupancyPercent) value.


      The value of InitiatingHeapOccupancyPercent determines when G1 will start the marking cycle to determine liveness in the old generation of the Java heap. After liveness calculation, G1 will start reclaiming space in the old generation. Currently the value of InitiatingHeapOccupancyPercent must be set manually. This poses several challenges to the user:

      If the user sets it too low, and let G1 start marking too early compromises throughput as then G1 will not make use of available Java heap memory to delay the marking cycle which requires some CPU usage. Given the current default value of 45, this means that G1 will start marking if 45% of the old generation is full, and start space reclamation slightly later. This means that up to around 50% of heap will be effectively unused. In case the average live set size of the application is larger than 45, G1 will start the marking right after space reclamation all the time.

      Setting the InitiatingHeapOccupancyPercent value too high means that G1 will not finish marking and will not start space reclamation before free space in the old generation runs out, potentially leading to time consuming full collections.


      Let G1 by default determine the current optimal value of InitiatingHeapOccupancyPercent given allocation rates and the time it takes to perform liveness analysis.


      There are two new switches to control adaptive sizing of InitiatingHeapOccupancyPercent: G1AdaptiveIHOPNumInitialSamples (experimental, default: 3): The number of samples for allocation rate and marking cycle length after which G1 will start adaptively sizing the InitiatingHeapOccupancyPercent variable. If there are less than this amount of samples available, use the value of InitiatingHeapOccupancyPercent directly for starting marking cycles. G1UseAdaptiveIHOP (product, default true): Enable adaptive sizing of the InitiatingHeapOccupancyPercent (IHOP).

      In terms of changes to g1_globals.hpp:

      product(bool, G1UseAdaptiveIHOP, true,
              "Adaptively adjust the initiating heap occupancy from the "
              "initial value of InitiatingHeapOccupancyPercent. The policy "
              "attempts to start marking in time based on application "
      experimental(size_t, G1AdaptiveIHOPNumInitialSamples, 3,
              "How many completed time periods from initial mark to first "
              "mixed gc are required to use the input values for prediction "
              "of the optimal occupancy to start marking.")
              range(1, max_intx)


        Issue Links



              tschatzl Thomas Schatzl
              tschatzl Thomas Schatzl
              Erik Helin
              0 Vote for this issue
              3 Start watching this issue