OperatingSystemImpl should factor cpu shares when calculating system load

David Holmes david.holmes at oracle.com
Mon May 3 22:21:35 UTC 2021


Hi,

Is this related to the issue reported here:

https://bugs.openjdk.java.net/browse/JDK-8265836

Cheers,
David

On 4/05/2021 3:14 am, Argha C wrote:
> Hello,
> I wanted to report an issue we're seeing with the load calculation, when 
> running with cpu shares > 1, in a container environment. Specifically, 
> the implementation of /OperatingSystemImpl#getCpuLoad./
> /
> /
> /Problem/
> /
> /
> When running with allocation of multiple cpu shares, ie. > 1 unit, the 
> load numbers do not comply with the expected range of 0-1. In the 
> example screenshot, it goes beyond 4.
> This miscalculation throws off load based system heuristics, when 
> running in a container based environment.
> 
> /Proposed solution/
> /
> /
> In a container aware environment, for load average calculation, the 
> number of cpu cycles, ie. /getCpuPeriod /must be multiplied by the 
> number of requested cpu shares by the process, ie. /getCpuShares./
> This would ensure that the load calculation uses the correct denominator 
> for elapsed time slice periods.
> 
> In the screenshot below, this would mean using /getCpuShares /as a 
> multiplier for /periodLength./
> 
> Please consider validating this behavior. I'd be happy to submit a PR 
> but I'm not an openjdk author/contributor.
> Thanks for your consideration.


More information about the serviceability-dev mailing list