Repository navigation
perf: introduce endpoint slice indexer - #9221
Conversation
Signed-off-by: kkk777-7 <[email protected]>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9221 +/- ##
==========================================
+ Coverage 75.28% 75.31% +0.03%
==========================================
Files 252 252
Lines 41536 41573 +37
==========================================
+ Hits 31269 31310 +41
+ Misses 8143 8135 -8
- Partials 2124 2128 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: kkk777-7 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
this's a tradeoff between memory and cpu, should we add feature flag? |
|
So, I agree that it would be better for user to choose controller behavior. |
|
Agreed on adding config options for it but would propose we make this the default behavior. |
let's discuss this in the meeting this week. |
There was a problem hiding this comment.
+1 to making this the default.
I don't think we need a permanent opt-out here — trading a bit more control-plane memory for faster xDS convergence seems like a reasonable default, and I'd lean away from adding an API knob for it since that would expose EG's internal implementation details that we'd probably rather keep flexible.
That said, to keep upgrades smooth, what if we gate it behind a runtime flag (defaulting to on)? That way operators who need a little time to expand node/pod memory can temporarily disable it. We could then plan to drop the flag after 1.9.0 once it's had time to prove out.
It might also be worth adding a note to the release notes reminding operators to bump the EG pod's memory requests/limits — or disable the gate — before upgrading, especially in production environments with a large number of EndpointSlices.
That's good point, I agree. So, I'll update the PR so that this behavior becomes the default setting and can be controlled via runtime flags. |
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
/retest |
|
ptal 🙏 @zhaohuabing @zirain @jukie |
|
The PR LGTM. Thanks for the great performance improvement! Just one small docs nit. |
Signed-off-by: kkk777-7 <[email protected]>
|
/retest |
|
cc @arkodg since we had discussion in the past. |
|
LGTM. Deferring to @arkodg |
Signed-off-by: kkk777-7 <[email protected]>


What this PR does / why we need it:
Currently, we have a bottleneck when listing EndpointSlices in large-scale environments.
We observed this with pprof; see #7573
The current implementation uses a label selector when listing EndpointSlice. In controller-runtime's cache client, label selectors first fetch all resources from cache, either in the specified namespace or across all namespaces, and then filter out non-matching items. when there are many EndpointSlices, this becomes expensive.
https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/cache/internal/cache_reader.go#L112-L188
This PR adds field indexers for EndpointSlices and uses indexed field selectors instead of label selectors when looking up EndpointSlices for a backend.
In a test environment with 2,000 Services and 4,000 EndpointSlices, this made the EndpointSlice listing path about 12x faster.
Before
After
Which issue(s) this PR fixes:
Fixes #7573
Release Notes: Yes