RFR: 8296125: Add a command line option to set a refresh rate of the OS cached metrics in Linux [v2]

Olga Mikhaltsova omikhaltcova at openjdk.org
Wed Nov 2 17:50:23 UTC 2022


On Wed, 2 Nov 2022 00:19:35 GMT, Olga Mikhaltsova <omikhaltcova at openjdk.org> wrote:

>> I would like to add a new command line product option:
>> -XX:OsCachedMetricsRefreshRate=value, -
>> where a value is times per second and is in the range [1; 1000000000].
>> 
>> It substitutes the hardcoded timeout of 20 ms between re-readings of the OS cached metrics introduced in [JDK-8232207](https://bugs.openjdk.org/browse/JDK-8232207) and allows to set this timeout (as a refresh rate) by a user at the launch time.
>> 
>> This option will be available only on Linux.
>> 
>> It can be used as followed:
>> java -XX:OsCachedMetricsRefreshRate=100 MyApp
>
> Olga Mikhaltsova has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Made the option (OsCachedMetricsRefreshRate) DIAGNOSTIC
>  - Moved oscontainer_cache_timeout() from os::Linux to OSContainer

Concerning the type of the option I personally think that it would be better to have a product flag (as it was initially suggested) because as I realised from the comments to JDK-8232207, nobody knows for sure if a 20ms grace time is good enough for all use-cases. With high probability this request will be raised again in some time. A product flag allows not to return to this question any more. Additionally imho this approach is better then the hardcoded macro value and by default a user gets this 20 ms as a timeout anyway (in case this option is not used at a command line at an app launch time).

But a user is not able to provide me with a reproducer and there is no 100% guarantee that this 20 ms timeout is a culprit => maybe it's better to have a diagnostic option for the 1st iteration and to wait for the 2nd user request to have this option as product and only after that to propose CSR and to open PR with request to convert this option to a product one.

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

PR: https://git.openjdk.org/jdk/pull/10918


More information about the hotspot-runtime-dev mailing list