-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further fixes to context handling in LookupResources and performance improvements #1397
Merged
Conversation
This file contains 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
github-actions
bot
added
area/api v1
Affects the v1 API
area/dispatch
Affects dispatching of requests
area/tooling
Affects the dev or user toolchain (e.g. tests, ci, build tools)
labels
Jun 15, 2023
vroldanbet
reviewed
Jun 16, 2023
The previous approach of having the limit tracker control the context was causing parallelized branches of the Reachable Resources to be canceled early; we were ignoring this error (incorrectly) and thus, reachable resources could return partial results. Instead, we now manually and explicitly detach the context and cancel it explicitly when no further dispatching is needed.
This changes the datastore query to no longer have a limit, and instead produce a series of chunks for parallelized processing using the same parallelization code as the entrypoint cursor parallelization system. This is done in service of performance: a single database query is faster than making multiple roundtrips. This change also removes the limits on dispatching reachable resources and lookup resources in favor of grabbing as many results as possible and canceling dispatch once the overall limit has been reached. While this results in slightly more work being done than is necessary, it is far more performant from the caller's perspective (especially for no-limit calls), because there is no need to re-enter the reachable resources dispatch tree. As per the above change around limits, this change also further adjusts how context cancelation functions and adds a slew of tests to cover these new cases
josephschorr
force-pushed
the
lr-context-and-perf
branch
from
June 16, 2023 20:43
7ffc816
to
2937947
Compare
Updated |
vroldanbet
approved these changes
Jun 19, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area/api v1
Affects the v1 API
area/dispatch
Affects dispatching of requests
area/tooling
Affects the dev or user toolchain (e.g. tests, ci, build tools)
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.
(See commit messages for detailed information)