posix: aws_system_info_processor_count over-estimates the number of CPUs on k8s / in container #893
Labels
feature-request
A feature should be added or improved.
needs-review
This issue or pull request needs review from a core team member.
p3
This is a minor priority issue
The
posix
aws_system_info_processor_count()
function returns the count of physical processors viasysconf(_SC_NPROCESSORS_ONLN)
wheresysconf
is available (on many Linux systems).Within a container, k8s pod, or any other resource constrained environment (cpusets, cgroups), this causes the
number of available CPUs to be over-estimated.
For instance, on a k8s job with 4 requested CPUs on a 64-core node, the reported value is 64, not 4.
To avoid this over-estimation, additional queries are necessary, looking at for
Here is a good write-up on how this is estimated in the JDK, producing this formula that takes the above into account:
The text was updated successfully, but these errors were encountered: