RFR: 8265836: OperatingSystemImpl.getCpuLoad() returns incorrect CPU load inside a container [v6]
Hao Tang
github.com+7947546+tanghaoth90 at openjdk.java.net
Thu May 27 08:40:12 UTC 2021
On Thu, 27 May 2021 00:47:23 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> `getCpuLoad()` has been based on total time since the start of the container, but after this PR, it is based on the ticks in earlier call. Is it ok?
> IMHO it can be accepted because it is the same with load average on Linux, but I concern we may need CSR because this PR changes behavior.
@YaSuenag Thanks for your comment. I can give two reasons for that.
1. The javadoc of `OperatingSystemMXBean.getCpuLoad` indicates the method should return "recent cpu usage".
https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java#L156
2. The initial (container-unaware) implementation `getCpuLoad0` does reports recent CPU load, which the container-aware implementation must be consistent.
> but after this PR, it is based on the ticks in earlier call. Is it ok?
The result might be too coarse/inaccurate, if the time between two calls is too long/short. Any comments for that?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3656
More information about the serviceability-dev
mailing list