RFR: 8357471: GenShen: Share collector reserves between young and old [v2]
William Kemper
wkemper at openjdk.org
Fri May 23 23:45:53 UTC 2025
On Fri, 23 May 2025 19:23:32 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> Genshen independently reserves memory to hold evacuations into young and old generations. We have found that under duress, it is sometimes difficult for mixed evacuations to make progress because the reserves in old are too small and we cannot expand old because young is running so frequently that it does not have the excess memory required to justify expansion of old (and shrinking of young).
>>
>> This PR exploits the fact that the reserves in young are often much larger than young requires to carry out its anticipated next GC cycle. In this case, we can share the young collector reserves with the old generation. This allows much more effective operation of mixed evacuations when GC is running at or near its full capacity.
>>
>> The following spreadsheet snapshots highlight the benefits of this change. In control with 6G heap size, we perform large numbers of mixed evacuations, but each mixed evacuation has very low productivity (e.g. one region at a time). This causes excessive delays in reclaiming the garbage from old, which is required to shrink old and expand young. This is why we see the large number of unproductive GC cycles, many of which degenerate and a few of which upgrade to full GC. In the experiment with 6G heap size, there are far fewer mixed cycles, but they are each much more productive. The total number of GC cycles decreases significantly.
>>
>> 
>>
>> With 7G heap size, the benefits of this PR manifest as a decrease in mixed evacuations, which also allows us to decrease total GC cycles. By more quickly reclaiming old garbage, we are able to more quickly expand young, which decreases the number of young GC cycles. This reduces CPU load. The impact on response times is not as significant as with the 6G heap size. We see slight improvement at p50-p99.9, with slight degradation at p99.99 through p100.
>>
>> 
>>
>> At 8G heap size, the GC is not at all stressed. We see approximately the same numbers of GC cycles, slight degradation of response times at p50-p99, slight improvement in response times at p99.9-p100.
>>
>> 
>>
>> The command line for these comparisons follows:
>>
>>
>> ~/github/jdk.share-collector-reserves/build/linux-x86_64-server-release/images/jd...
>
> Kelvin Nilsen has updated the pull request incrementally with two additional commits since the last revision:
>
> - respond to reviewer feedback
> - Keep gc cycle times with heuristics for the relevant generation
src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp line 376:
> 374: "runs out of memory too early.") \
> 375: \
> 376: product(uintx, ShenandoahOldEvacPercent, 75, EXPERIMENTAL, \
This is much easier to read. Thank you for making the change!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25357#discussion_r2105525384
More information about the hotspot-gc-dev
mailing list