Yida Wu has uploaded this change for review. ( https://gerrit.cloudera.org/25261
Change subject: IMPALA-15587: Detect CPU cores Impala can run on ...................................................................... IMPALA-15587: Detect CPU cores Impala can run on CpuInfo::num_cores() is the number of CPU cores of the machine. In a container or under taskset, Impala can run on fewer cores than that, because of the CPU affinity mask of the process or the cgroup CPU limit. This adds CpuInfo::effective_num_cores(): the smallest of num_cores(), the cores in the CPU affinity mask from sched_getaffinity() and the cgroup CPU limit, rounded up. The cgroup CPU limit is read from cpu.max on cgroup v2 and from cpu.cfs_quota_us and cpu.cfs_period_us on cgroup v1, by the new CGroupUtil::FindCGroupCpuLimit(). If --num_cores is set, the effective number of cores is num_cores(). The effective number of cores is shown as "Effective Cores" in the CPU info of the debug web UI and in the log at startup, and each backend reports it to the cluster in the new MachineInfoPB.cpu_effective_num_cores. num_cores() does not change, so nothing else that uses the number of cores changes. Testing: - Added BE tests for parsing cpu.max and for converting a CPU quota to cores. - Checked manually that the effective cores follow taskset and that --num_cores overrides them. Change-Id: I93b4e020e03225398eadbe1c84b975ae38c9d505 Assisted-by: Claude Opus 5.5 (Claude Code) --- M be/src/service/impala-server.cc M be/src/util/cgroup-util.cc M be/src/util/cgroup-util.h M be/src/util/cpu-info.cc M be/src/util/cpu-info.h M be/src/util/proc-info-test.cc M common/protobuf/statestore_service.proto 7 files changed, 148 insertions(+), 0 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/61/25261/1 -- To view, visit https://gerrit.cloudera.org/25261 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I93b4e020e03225398eadbe1c84b975ae38c9d505 Gerrit-Change-Number: 25261 Gerrit-PatchSet: 1 Gerrit-Owner: Yida Wu <[email protected]>
