Skip to content
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

GCE: Implement kube-env caching #6531

Merged
merged 4 commits into from
Feb 20, 2024
Merged

Conversation

BigDarkClown
Copy link
Contributor

@BigDarkClown BigDarkClown commented Feb 15, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Caching of kube-env for instance templates. The change greatly improves the CPU usage for idle clusters, as ~80% of the main loop time is spend on repetitive unmarshalling of kube-env.

The improvement is drastic for idle clusters even with only 3 MIGs. In my testing the loop time decreased from 1.25s to 0.25s.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 15, 2024
@k8s-ci-robot k8s-ci-robot added area/cluster-autoscaler area/provider/gce approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 15, 2024
@BigDarkClown BigDarkClown changed the title WIP: Kube env GCE: Implement kube-env caching Feb 15, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 15, 2024
Copy link
Contributor

@atwamahmoud atwamahmoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In General, LGTM
However I might be messing some stuff so it'd be safer if someone else took a quick look

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atwamahmoud, BigDarkClown

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@BigDarkClown BigDarkClown changed the title GCE: Implement kube-env caching WIP: GCE: Implement kube-env caching Feb 16, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2024
@BigDarkClown BigDarkClown changed the title WIP: GCE: Implement kube-env caching GCE: Implement kube-env caching Feb 16, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2024
@atwamahmoud
Copy link
Contributor

atwamahmoud commented Feb 19, 2024

/lgtm

It would be better to omit the Get from function names but it's out of scope for this PR since we'll have to rename not just added functions but older ones to remain consistent

Edit: Ahh, I forgot I'm not in the OWNERS file passing to @jayantjain93

@k8s-ci-robot
Copy link
Contributor

@atwamahmoud: changing LGTM is restricted to collaborators

In response to this:

/lgtm

It would be better to omit the Get from function names but it's out of scope for this PR since we'll have to rename not just added functions but older ones to remain consistent

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.

}

// InvalidateAllMigKubeEnvs clears the kube-env cache
func (gc *GceCache) InvalidateAllMigKubeEnvs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we ever need either Invalidate ? Since instance templates are immutable, we probably won't ever call this. What we might want instead though is some expiration mechanism - to avoid memleaks in clusters with high MIG churn. This is a nice to have though, I don't expect single CA instance to observe enough instance templates over entire process lifetime to visibly inflate memory usage.

@x13n
Copy link
Member

x13n commented Feb 20, 2024

I left a comment, but that is something to follow up on later, not in this PR, so let's merge as is.

/lgtm

Btw, @atwamahmoud - you don't need to be an OWNER to /lgtm, you just need to be a Kubernetes org member.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2024
@k8s-ci-robot k8s-ci-robot merged commit 2c2ec59 into kubernetes:master Feb 20, 2024
6 checks passed
@BigDarkClown BigDarkClown mentioned this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cluster-autoscaler area/provider/gce cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants