-
Notifications
You must be signed in to change notification settings - Fork 95
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
Use indexer when listing cached types by hash #326
Conversation
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.
Small nit then LGTM.
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.
Two minor nits, but they don't change the validity of the changes here.
pkg/apply/desiredset_process_test.go
Outdated
@@ -109,3 +113,157 @@ func Test_multiNamespaceList(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func Test_canIndexByHash(t *testing.T) { |
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.
There is nothing to change here; it's just a suggestion for future tests. We would get a lot of mileage by having one test function for the entire list(...)
function since we can better verify the desired interaction with the current behavior.
d137c74
to
c3044b9
Compare
@KevinJoiner I had to upgrade the |
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.
You can either squash all the commits other than the lint update and force push or we can just squash everything when we merge.
16a4fb8
to
77c0d98
Compare
Done! Thanks for your review! |
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
@KevinJoiner I see I cannot merge this, can you help? |
* Add indexer by hash for cached types * Upgrade golangci-lint GitHub action, since it always fails now
* Add indexer by hash for cached types * Upgrade golangci-lint GitHub action, since it always fails now
Relates to rancher/fleet#1842
Extending
WithCacheType
option, those types will be indexed by their hash label (objectset.rio.cattle.io/hash
), which every object produced or modified byApply
has. This is a direct replacement for usingList
with an exact label selector, which is certainly more expensive.The ultimate goal of this change is reducing CPU usage, which has been successfully observed by testing this change in a custom Fleet build (along with rancher/fleet#1857), where in some cases produced around 40%-50% CPU drop (see SURE-6990).