Merged
Conversation
In Kubernetes shares are calculated from resources.requests.cpu, quota & period - from limits. When you configure only requests without limits - the container still can use all the cores. So you see all the cores the system has. (because of requests the pod just can't be scheduled on the node which have less cpus) So the effective CPU count is all the available cores if you don't have limits, or calculated from quota & period if you have the limits.
alexey-milovidov
approved these changes
Apr 1, 2022
robot-clickhouse
pushed a commit
that referenced
this pull request
Apr 1, 2022
alexey-milovidov
added a commit
that referenced
this pull request
Apr 3, 2022
Backport #35815 to 22.3: Fix cgroups cores detection
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Kubernetes shares are calculated from resources.requests.cpu, quota & period - from limits.
When you configure only requests without limits - the container still can use all the cores. So you see all the cores the system has.
(because of requests the pod just can't be scheduled on the node which have fewer CPUs)
So the effective CPU count is all the available cores if you don't have limits, or calculated from quota & period if you have the limits.
See the details of the problem https://kb.altinity.com/altinity-kb-setup-and-maintenance/cgroups_k8s/
Some info on cores calculation in cgroups: https://github.com/openjdk/jdk/blob/e07fd395bdc314867886a621ec76cf74a5f76b89/src/hotspot/os/linux/cgroupSubsystem_linux.cpp#L499-L512
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Respect only quota & period from groups, ignore shares (which are not really limit the number of the cores which can be used)
/cc @JaySon-Huang @Felixoid