RFR: 8258431: Provide a JFR event with live set size estimate [v12]

Stefan Johansson sjohanss at openjdk.java.net
Tue Mar 16 14:15:33 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)` ?
> 
Anywhere in there should be fine, we should look if there is anything related in there it could be grouped with.

> I am getting some funny numbers with this change - basically, last known live size is getting bigger than the current used size ��
> 
> ![Screen Shot 2021-03-16 at 1 28 27 PM](https://user-images.githubusercontent.com/738413/111308939-97b06d80-865b-11eb-9e2f-d595b49d6401.png)

This is strange, what kind of GCs are happening around those samples?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2579


More information about the hotspot-jfr-dev mailing list