THREESCALE-15465 refactor: use new cpu.requests formula from Kubernetes#1595
Open
tkan145 wants to merge 1 commit into
Open
THREESCALE-15465 refactor: use new cpu.requests formula from Kubernetes#1595tkan145 wants to merge 1 commit into
tkan145 wants to merge 1 commit into
Conversation
9d4dd07 to
7de3852
Compare
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.
What
https://redhat.atlassian.net/browse/THREESCALE-15465
Recently reported by support team that APIcast run with a wrong number of workers. From this blog New Conversion from cgroup v1 CPU Shares to v2 CPU Weight the formula to calculate cpu.weight has been changed in the recent version of runc/crun
cpu.weight = (1 + ((cpu.shares - 2) * 9999) / 262142)cpu.weight = 10 ^ (L^2 / 612 + 125 * L / 612 − 7 / 34), where: L=log2(cpu.shares)Required Code Change
The implementation in cpu_shares should be updated to use the new conversion formula. This change is required to ensure that requested CPU values are computed correctly when running on cgroup v2.
Impact
You can use this playground to play with different values.
https://go.dev/play/p/EIFB4_Ia4ae
2.16
master
With this change, the APIcast will run with less workers on older cluster with older version of container runtime. However, when I check, the container runtime does not seems to tied to a specific version major of OCP and make it hard to adjust these value during runtime.
For example:
In my opinion, the best is to apply this change to the master branch, then flag it in the release log to mark it as a breaking change.
Verification steps
You will need a cluster with new version of runc/crun, I tried with Docker but it just does not handle cpu.weight the way that I wanted. I'm using 4.20.27 in this case
By default, APIcast is setup with the following
Cross check with the table above, we can see
2 workershere for500mof cpu shares.