fix: enqueue a single request for all resources#1813
Conversation
Signed-off-by: David Boslee <david@goteleport.com>
Signed-off-by: David Boslee <david@goteleport.com>
| if err := c.Watch( | ||
| source.Kind(mgr.GetCache(), &egv1a1.RateLimitFilter{}), | ||
| &handler.EnqueueRequestForObject{}, | ||
| handler.EnqueueRequestsFromMapFunc(r.enqueueClass), |
There was a problem hiding this comment.
can we also do this for L1318 ?
|
|
||
| func (r *gatewayAPIReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { | ||
| r.log.WithName(request.Name).Info("reconciling object", "namespace", request.Namespace, "name", request.Name) | ||
| r.log.WithName(request.Name).Info("reconciling gateways") |
There was a problem hiding this comment.
can we add a comment / doc string mentioning that all watched resources trigger this single Reconcile . Also can we discard _ reconcile.Request with a comment mentioning that the requests content dont map to a specific resource.
Codecov Report
@@ Coverage Diff @@
## main #1813 +/- ##
==========================================
+ Coverage 65.11% 65.21% +0.10%
==========================================
Files 86 86
Lines 12316 12318 +2
==========================================
+ Hits 8019 8033 +14
+ Misses 3782 3774 -8
+ Partials 515 511 -4
|
|
this is a neat idea, thanks for implementing this @dboslee, trying to understand this better, by using |
Signed-off-by: David Boslee <david@goteleport.com>
I think you've got it more or less. There isn't a specific duration here other than the rate limiting provided by the controller. Here are a few examples describing the behavior. At startup a single call to reconcile is executed since the controller will wait for all caches to initialized and events are coalesced. In general, during a re-sync of many resources, any events that are processed before The time in between calls to |
arkodg
left a comment
There was a problem hiding this comment.
LGTM, thanks for introducing this design pattern to improve performance at scale !
ah makes sense, thanks for the explanation ! |
What this PR does / why we need it:
The current behavior of the controller is to run
Reconcilefor each resource that is updated. This gets quite expensive when you have 100s-1000s of resources.This change allows for multiple resource updates to result in a single run of
Reconcile.This greatly reduces the cpu/memory consumption at startup and during periodic re-syncs of all resources.
Which issue(s) this PR fixes:
Fixes #1797