[fix] [broker] incorrect CPU usage collected by pulsar#17820
[fix] [broker] incorrect CPU usage collected by pulsar#17820thetumbled wants to merge 10 commits into
Conversation
|
add unit test and fix the bug already. |
|
LGTM. As per the new PR process, plz raise a PR on your fork repo and run the CI tests on your fork env first.(and link back the fork repo PR in this PR). |
|
|
@thetumbled hi, I move this PR to release/2.9.5, if you have any questions, please ping me. thanks. |
|
PTAL, thanks. @hangc0276 |
|
The pr had no activity for 30 days, mark with Stale label. |
|
As discussed on the mailing list https://lists.apache.org/thread/w4jzk27qhtosgsz7l9bmhf1t7o9mxjhp, there is no plan to release 2.9.6, so I am going to remove the release/2.9.6 label |
|
PTAL, thanks. @hangc0276 |
| if (quota > 0) { | ||
| return 100.0 * quota / period; | ||
| } | ||
| int totalCpuCount = getTotalCpuCount(); |
There was a problem hiding this comment.
Actually, java 17 tracks container-aware resource usage. I think we just need to read jvm cpu limit and load if the jvm already provides the container-aware cpu limit and load.
Reference:
https://developers.redhat.com/articles/2022/04/19/java-17-whats-new-openjdks-container-awareness
|
Addressed by #16832 |
Fixes #17815
Incorrect CPU usage collected by pulsar
Motivation
cpu usage reported by pulsar is greater than 100%,needed to be fixed.
Modifications
org.apache.pulsar.broker.loadbalance.LinuxInfoUtils#getTotalCpuLimit
if CGROUP is enabled and quota is -1, we utilize the content of /sys/fs/cgroup/cpuset/cpuset.cpus to get the correct number of CPUs in the system.
Verifying this change
This change added tests and can be verified as follows:
(example:)
Documentation
doc-not-neededMatching PR in forked repository
PR in forked repository: thetumbled#1