-
Notifications
You must be signed in to change notification settings - Fork 495
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
Routing: Adds Parallel Request Hedging #4198
Merged
kirankumarkolli
merged 172 commits into
master
from
users/nalutripician/parallelHedgingPreview
Jul 12, 2024
Merged
Routing: Adds Parallel Request Hedging #4198
kirankumarkolli
merged 172 commits into
master
from
users/nalutripician/parallelHedgingPreview
Jul 12, 2024
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
NaluTripician
requested review from
sboshra,
adityasa,
neildsh,
kirankumarkolli,
ealsur,
FabianMeiswinkel and
kirillg
as code owners
December 28, 2023 18:14
NaluTripician
changed the title
Routing: Adds Parallel Request Hedging in Preview Mode
Routing: Adds Parallel Request Hedging
Dec 28, 2023
…github.com/Azure/azure-cosmos-dotnet-v3 into users/nalutripician/parallelHedgingPreview
ealsur
reviewed
Jul 10, 2024
kirankumarkolli
previously approved these changes
Jul 11, 2024
ealsur
reviewed
Jul 11, 2024
ealsur
reviewed
Jul 11, 2024
Co-authored-by: Matias Quaranta <[email protected]>
ealsur
reviewed
Jul 11, 2024
ealsur
reviewed
Jul 11, 2024
…github.com/Azure/azure-cosmos-dotnet-v3 into users/nalutripician/parallelHedgingPreview
ealsur
reviewed
Jul 11, 2024
ealsur
previously approved these changes
Jul 11, 2024
ealsur
previously approved these changes
Jul 11, 2024
…github.com/Azure/azure-cosmos-dotnet-v3 into users/nalutripician/parallelHedgingPreview
ealsur
approved these changes
Jul 12, 2024
kirankumarkolli
approved these changes
Jul 12, 2024
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.
Pull Request Template
Description
See issue #3782.
The goal of this PR is to introduce parallel request hedging + availability strategies to the .NET SDK. Users will be able to create an availability strategy with a threshold specifying when the request hedging triggers as well as a step time which will indicate how often after the availability strategy triggers parallel requests will be sent out. If the step is 0, only one parallel request will be sent out. If set to
TimeSpan.0
then only all parallel requests will be sent out simutaniously.Design
Sending out parallel requests will be done in the
RequestInovkerHandler
. Before a request is sent out first, we check to see if a request can be sent out with parallel request hedging. Currently, only document read requests can use this feature.Next, the request is cloned, and parallel requests are routed to all available read regions by setting the exclude regions property in the request options. Finally, all requests are sent out with the appropriate delay and once the SDK receives a response, all in flight parallel requests are canceled.
Parallel Hedging
When Building a new
CosmosClient
there will be an option to include Parallel hedging in that client.or
The example above will create a
CosmosClient
instance with AvailabilityStrategy enabled with at 500ms threhshold. This means that if a request takes longer than 500ms the SDK will send a new request to the backend in order of the Preferred Regions List. If still no response comes back after the step time, another parallel request will be made to the next region. The SDK will then return the first response that comes back from the backend. The threshold parameter is a required parameter can be set to any value greater than 0. There will also be options to specify all options for theAvailabilityStrategyOptions
object at request level and enable or disable at request level. If no client levelAvailabilityStrategy
is set, addingAvailabilityStrategyOptions
to the request options will allow the request to use anAvailabilityStrategy
.Override
AvailabilityStrategy
:Disabling availability strategy:
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber