-
Notifications
You must be signed in to change notification settings - Fork 542
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
Fix memory usage when listing pods/events #1477
Fix memory usage when listing pods/events #1477
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @marseel! |
Hi @marseel. Thanks for your PR. I'm waiting for a kubernetes 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. |
return pm.kubeClient.CoreV1().Events(v1.NamespaceAll).List(options) | ||
o := metav1.ListOptions{ | ||
Limit: 1, | ||
FieldSelector: eventSelector, |
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.
Actually - you don't want this FieldSelector.
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.
Done.
@@ -28,7 +28,6 @@ import ( | |||
|
|||
const ( | |||
resyncPeriod = time.Duration(0) | |||
watchListPageSize = 5000 |
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.
@mborsz - given we don't need this, do we want to revert the changes you were doing?
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.
Yes, once we validate this approach, we can submit follow up PR that will remove this, fork of client-go and other ugly stuff I added.
slo-monitor/Makefile
Outdated
@@ -13,7 +13,7 @@ | |||
# limitations under the License. | |||
|
|||
PACKAGE = k8s.io/perf-tests/slo-monitor | |||
TAG = 0.14.0 | |||
TAG = 0.14.1 |
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.
let's make 0.15 - it's a bit non-negligible change
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.
Done.
1e393df
to
bd0233e
Compare
return pm.kubeClient.CoreV1().Pods(v1.NamespaceAll).List(options) | ||
// slo monitor is not using list of pods. | ||
// It's only used to get resourceVersion for Watch. | ||
// This implementation allows us to reduce memory usage significantly for large clusters. |
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.
nit:
slo-monitor is not using the pods returned from the list
(it uses NoStore implementation of Store which discards them),
only the resourceVersion is used to instantiate the watch from this point.
This trick allows us to reduce memory usage on startup and further relists.
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.
Done, I've only changed NoStore to NoStoreQueue
bd0233e
to
0ebe43c
Compare
/ok-to-test /approve Will let @mborsz to lgtm |
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marseel, mborsz, wojtek-t 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 |
What type of PR is this?
Limits memory usage after slo-monitor restart
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: