JDK-8199262 : Implement adaptive sizing algorithm for IHOP
  • Type: CSR
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P2
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 9
  • Submitted: 2015-11-17
  • Updated: 2018-03-21
  • Resolved: 2018-03-21
Related Reports
CSR :  
Description
Summary
-------
Provide adaptive sizing for the IHOP (InitiatingHeapOccupancyPercent) value.

Problem
------
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.

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

Specification
-------------
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 "
            "behavior.")

    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)

Comments
Base base bug was fixed in JDK 9. It is not clear to me if this is a retroactive CSR for that change or a proposal for additional work since the fixVersion field is not set. Marking as pended until this is sorted out.
14-03-2018

Manually moved to JDK project to finally show up in the CSR dashboard for review. Not sure why it is confidential, as this is used for an open flag.
07-03-2018