parallelize InformerManager changeNamespaces#3430
Open
TQJADE wants to merge 1 commit into
Open
Conversation
InformerManager#changeNamespaces starts informers for newly added namespaces sequentially via Set#forEach. Each source.start() call blocks up to cacheSyncTimeout waiting for cache sync, so when N namespaces are added and any of them are slow or RBAC-denied (a common case under stopOnInformerErrorDuringStartup=false), the total wall-clock is O(N * cacheSyncTimeout). The Controller holds its EventProcessor stopped across this entire call, dropping watch events with "Skipping event ... because the event processor is not started" and producing multi-minute reconcile delays after dynamic namespace updates. Align changeNamespaces with the existing parallel pattern already used by InformerManager#start (boundedExecuteAndWaitForAllToComplete on the caching executor). Wall-clock drops from O(N * timeout) to O(timeout). The sources map is already a ConcurrentHashMap, so no additional synchronization is required. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Revert "178463593 test" This reverts commit c3550e41e9bfbf3bc3619257aa0bb26ae46ac2dc. Signed-off-by: Qi Tan <16416018+TQJADE@users.noreply.github.com>
11b8d70 to
6aa69a1
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves dynamic namespace updates for informer-based event sources by starting informers for newly-added namespaces in parallel, matching the startup strategy already used by InformerManager#start and reducing end-to-end pauses when changeNamespaces is invoked.
Changes:
- Parallelize informer startup for newly added namespaces in
InformerManager#changeNamespacesusingExecutorServiceManager#boundedExecuteAndWaitForAllToComplete. - Avoid unnecessary executor work by early-returning when no new namespaces need informers started.
Comment on lines
+127
to
+129
| ns -> { | ||
| final InformerWrapper<R> source = createEventSourceForNamespace(ns); | ||
| source.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InformerManager#changeNamespaces starts informers for newly added namespaces sequentially via Set#forEach. Each source.start() call blocks up to cacheSyncTimeout waiting for cache sync, so when N namespaces are added and any of them are slow or RBAC-denied the total wall-clock is O(N * cacheSyncTimeout). The Controller holds its EventProcessor stopped across this entire call, dropping watch events with "Skipping event ... because the event processor is not started" and producing multi-minute reconcile delays after dynamic namespace updates.
Align changeNamespaces with the existing parallel pattern already used by InformerManager#start (boundedExecuteAndWaitForAllToComplete on the caching executor).
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com