RFR: 8258431: Provide a JFR event with live set size estimate [v12]
Jaroslav Bachorik
jbachorik at openjdk.java.net
Tue Mar 16 12:32:12 UTC 2021
On Tue, 16 Mar 2021 11:28:50 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>>> Sure, but for the event to be useful we want the reported value to be as close to the reality as possible. I don't understand why you want the lower bound, can you explain why? I would go for the upper bound, which in that case would be used() at the end of the GC. I know used() is not perfect, but for G1 this is the best "cheap" value we have for liveness at the end of any GC.
>>
>> Mostly because `used()` will report all live instances and potential garbage and will make it inconsistent with what the other GCs would report.
>>
>>> So as a middle road I would suggest to update G1CollectedHeap::gc_epilogue(bool full) to include:
>>>
>>> set_live(used());
>> With this you don't need the changes for the G1FullCollector. The liveness calculated at Remark would be used until the next young collection and I think here is where some improvements could be made. During the mixed phase a better solution would make use of the liveness information we have for the old regions together with what is newly allocated, but this needs further investigation.
>>
>> This sounds interesting. Let me try this out.
>
>> > Sure, but for the event to be useful we want the reported value to be as close to the reality as possible. I don't understand why you want the lower bound, can you explain why? I would go for the upper bound, which in that case would be used() at the end of the GC. I know used() is not perfect, but for G1 this is the best "cheap" value we have for liveness at the end of any GC.
>>
>> Mostly because `used()` will report all live instances and potential garbage and will make it inconsistent with what the other GCs would report.
>>
> The other STW GCs do report the same, right?
>
>> > So as a middle road I would suggest to update G1CollectedHeap::gc_epilogue(bool full) to include:
>> > set_live(used());
>> > With this you don't need the changes for the G1FullCollector. The liveness calculated at Remark would be used until the next young collection and I think here is where some improvements could be made. During the mixed phase a better solution would make use of the liveness information we have for the old regions together with what is newly allocated, but this needs further investigation.
>>
>> This sounds interesting. Let me try this out.
>
> Glad you like the idea :) I did a quick test locally and it shows the trend ok, even if it is an over estimate of live:
> live = 1.1 GB
> live = 1.2 GB
> live = 1.5 GB
> live = 1.7 GB
> live = 2.1 GB
> name = "G1Old"
> live = 1.4 GB
> live = 1.6 GB
> live = 1.8 GB
> live = 2.0 GB
> live = 2.3 GB
> live = 2.5 GB
> live = 2.8 GB
> live = 3.1 GB
> live = 3.3 GB
> live = 3.7 GB
> live = 4.0 GB
> live = 4.3 GB
> name = "G1Old"
> live = 1.2 GB
> G1Old is from concurrent mark events.
@kstefanj
Just to make sure - `set_live(used())` should be the last call in `G1CollectedHeap::gc_prologue(bool full)` ?
I am getting some funny numbers with this change - basically, last known live size is getting bigger than the current used size

-------------
PR: https://git.openjdk.java.net/jdk/pull/2579
More information about the hotspot-jfr-dev
mailing list