thetumbled commented on code in PR #17820:
URL: https://github.com/apache/pulsar/pull/17820#discussion_r980648364


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LinuxInfoUtils.java:
##########
@@ -85,6 +86,8 @@ public static double getTotalCpuLimit(boolean 
isCGroupsEnabled) {
                 if (quota > 0) {
                     return 100.0 * quota / period;
                 }
+                int cpuCount = 
readTrimStringFromFile(Paths.get(CGROUPS_CPU_USAGE_PER_CPU_PATH)).split(" 
").length;

Review Comment:
   ```
   - cpuacct.usage_percpu
   reports the CPU time (in nanoseconds) consumed on each CPU by all tasks in 
this cgroup (including tasks lower in the hierarchy).
   - cpuacct.usage
   reports the total CPU time (in nanoseconds) consumed by all tasks in this 
cgroup (including tasks lower in the hierarchy).
   ```
   
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/sec-cpuacct
   
   The sum of the values in cpuacct.usage_percpu is equal to the value in 
cpuacct.usage,and we have calculated the cpu usage base on cpuacct.usage. Using 
cpuacct.usage_percpu to calculate cpu limit can ensure that the highest cpu 
usage is 100%.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to