Add configurable max workers for route controller instances #672
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.
What type of PR is this?
Feature/Improvement
Which issue does this PR fix:
#671
What does this PR do / Why do we need it:
Adds a configurable value for the number of max workers for route controller instances. Note this worker count applies to each route type: HTTP, GRPC, and TLS. This change also updates locking mechanism for target group garbage collection to be more performant and allow parallel execution for route reconciliation.
Testing done on this change:
Created 50 HTTP routes. On start or change, all 50 are reconciled. Previously with max workers = 1 (default), the reconciliation rate was 1/s and total time was roughly 50s. For 5 workers, the rate was closer to 5/s, and total time was around 12s. When set to very large numbers (e.g. 25 or 100), the controller encounters throttling from the Lattice APIs. At the default API rate limits, the controller maxes out between 5-10/s and handles the throttles fine enough. If customers need higher reconciliation rates, they can request API limit increases.
I also checked the Helm install, including a
--dry-runto verify the environment variable as well as a deployment. When run correctly, the max worker count will show in the logs.This is how I was eyeballing the reconciliation rate and found the issue with the target group GC lock.
Also validated the controller errors out when an invalid value is supplied.
Automation added to e2e:
n/a
Will this PR introduce any new dependencies?:
No
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No. Default for workers is still 1 if the value unspecified.
Does this PR introduce any user-facing change?:
Yes, new optional/opt-in feature.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.