-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
container/libcontainer: Improve limits file parsing perf #3396
Conversation
Only max open files is ever parsed from limits files, therefore this change optimizes for that case. Benchmark: ``` $ benchstat old.txt new.txt goos: linux goarch: amd64 pkg: github.com/google/cadvisor/container/libcontainer cpu: AMD Ryzen 5 3400GE with Radeon Vega Graphics │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ ProcessLimitsFile-8 85.012µ ± 1% 1.324µ ± 0% -98.44% (p=0.000 n=10) ``` On a GKE v1.27.4 production cluster, this code path used roughly 1.5% of the total kubelet CPU usage, and at 98.44% improvement this likely results in at least a 1.5% CPU reduction (perhaps even more since also less garbage is produced to be collected by the GC).
Hi @brancz. Thanks for your PR. I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
Thanks for the performance improvement, looks very reasonable to me, LGTM! |
What do we need to do to get this merged? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Looks fine with me. I doubt we will hit any instances where case sensitive check vs case insensitive check will matter
@bobbypage if you have concerns, please comment. Otherwise let's merge
/lgtm |
Only max open files is ever parsed from limits files, therefore this
change optimizes for that case.
Benchmark:
On a GKE v1.27.4 production cluster, this code path used roughly 1.5% of
the total kubelet CPU usage, and at 98.44% improvement this likely
results in at least a 1.5% CPU reduction (perhaps even more since also
less garbage is produced to be collected by the GC).
This change came out of a live stream that we do on a weekly basis trying to improve performance of popular open source software. Episode is here: https://www.youtube.com/watch?v=ricEoAdJNHc