gwctl performance improvements#3145
Merged
Merged
Conversation
Eg. When we have a set of HTTPRoutes and we want to fetch all Backends referenced by this HTTPRoute, it's slightly better to fetch all the Backends with one API call and then filter these out based on which are being referenced. This is in contrast with fetching each individual backend through a separate API call that is referenced by the HTTPRoutes. (Even at smaller scales, multiple API calls starts to seem inefficient)
Events associated with a resource need to be fetch independently for each resource. This means the number of API calls grows linearly with the number of resources that we have. - Pre-fetching events for all resources BEFORE PRINTING ANYTHING gives the impression of the CLI being unresponsive. - Lazily fetching events allows us to print the describe-view for a single resource fully before fetching events for the next one, thereby giving the user an impression of the CLI making progress. Also, it makes sense for Events to not be part of the ResourceModel given events are just tied with a single resource and have no interdependence (so don't need some pre-calculations)
mlavacca
approved these changes
Jun 12, 2024
Member
mlavacca
left a comment
There was a problem hiding this comment.
Looks great to me, thanks @gauravkghildiyal!
/lgtm
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauravkghildiyal, mlavacca The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
BobyMCbobs
pushed a commit
to BobyMCbobs/kubernetes-sigs-gateway-api
that referenced
this pull request
Jul 10, 2024
* Fetch resources in bulk instead of single API calls as the default. Eg. When we have a set of HTTPRoutes and we want to fetch all Backends referenced by this HTTPRoute, it's slightly better to fetch all the Backends with one API call and then filter these out based on which are being referenced. This is in contrast with fetching each individual backend through a separate API call that is referenced by the HTTPRoutes. (Even at smaller scales, multiple API calls starts to seem inefficient) * Lazily fetch events instead of making them part of the ResourceModel. Events associated with a resource need to be fetch independently for each resource. This means the number of API calls grows linearly with the number of resources that we have. - Pre-fetching events for all resources BEFORE PRINTING ANYTHING gives the impression of the CLI being unresponsive. - Lazily fetching events allows us to print the describe-view for a single resource fully before fetching events for the next one, thereby giving the user an impression of the CLI making progress. Also, it makes sense for Events to not be part of the ResourceModel given events are just tied with a single resource and have no interdependence (so don't need some pre-calculations)
BobyMCbobs
pushed a commit
to BobyMCbobs/kubernetes-sigs-gateway-api
that referenced
this pull request
Jul 22, 2024
* Fetch resources in bulk instead of single API calls as the default. Eg. When we have a set of HTTPRoutes and we want to fetch all Backends referenced by this HTTPRoute, it's slightly better to fetch all the Backends with one API call and then filter these out based on which are being referenced. This is in contrast with fetching each individual backend through a separate API call that is referenced by the HTTPRoutes. (Even at smaller scales, multiple API calls starts to seem inefficient) * Lazily fetch events instead of making them part of the ResourceModel. Events associated with a resource need to be fetch independently for each resource. This means the number of API calls grows linearly with the number of resources that we have. - Pre-fetching events for all resources BEFORE PRINTING ANYTHING gives the impression of the CLI being unresponsive. - Lazily fetching events allows us to print the describe-view for a single resource fully before fetching events for the next one, thereby giving the user an impression of the CLI making progress. Also, it makes sense for Events to not be part of the ResourceModel given events are just tied with a single resource and have no interdependence (so don't need some pre-calculations)
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.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Summary of changes (details available in commit logs):
Prioritize fetching resources in bulk rather than individually to reduce API call overhead. (Some simple performance tests with large number of resources indicated this provides the better overall UX)
Fetch events associated with resources on-demand when printing, enhancing responsiveness and minimizing unnecessary API calls (since events are not required in GET output)
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?:
/assign @mlavacca