-
Bug
-
Resolution: Fixed
-
P4
-
openjdk8u302, 11.0.12, 17, 18
-
b09
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8271955 | 17.0.2 | Severin Gehwolf | P4 | Resolved | Fixed | b01 |
JDK-8272204 | 17.0.1 | Severin Gehwolf | P4 | Resolved | Fixed | b06 |
JDK-8272380 | 11.0.14-oracle | Harold Seigel | P4 | Resolved | Fixed | b01 |
JDK-8271608 | 11.0.13 | Severin Gehwolf | P4 | Resolved | Fixed | b02 |
JDK-8272379 | openjdk8u312 | Severin Gehwolf | P4 | Resolved | Fixed | b05 |
JDK-8283666 | 8u341 | David Buck | P4 | Resolved | Fixed | b01 |
If JVM runs in a container which is limited CPU resource (quota, shares, cpu),
getProcessCpuLoad is incorrect.
getCpuLoad is correct.
set --cpu-quota=50000 --cpu-period=50000 to cgroup cpuset
my machine has 8 cores
cgexec -g cpu:cpuset ${java_path} TestCgroup
process:12.338474364318467
system98.79130556666667
```
import com.sun.management.OperatingSystemMXBean;
import java.lang.management.ManagementFactory;
public class TestCgroup {
private static OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(
OperatingSystemMXBean.class);
public static void main(String[] args) {
new Thread(() -> {
int i = 0;
while (true) {
i++;
if (i > 10000) {
i = i - 1000;
}
}
}).start();
while (true) {
System.out.println("process:"+osBean.getProcessCpuLoad() * 100);
System.out.println("system"+osBean.getSystemCpuLoad() * 100);
System.out.println(osBean.getAvailableProcessors());
try {
Thread.sleep(3000);
} catch (Throwable e) {
e.printStackTrace();
}
}
}
}
```
- backported by
-
JDK-8271608 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
-
JDK-8271955 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
-
JDK-8272204 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
-
JDK-8272379 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
-
JDK-8272380 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
-
JDK-8283666 OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers
- Resolved
- relates to
-
JDK-8265836 OperatingSystemImpl.getCpuLoad() returns incorrect CPU load inside a container
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/52a32a76
-
Commit openjdk/jdk17u/02ea80a6
-
Commit openjdk/jdk/25f00d78
-
Review openjdk/jdk11u-dev/183
-
Review openjdk/jdk17u/9
-
Review openjdk/jdk/4700
-
Review openjdk/jdk/4702