-
Notifications
You must be signed in to change notification settings - Fork 494
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
[Internal] Parallel Hedging: Adds Docs #4082
Conversation
docs/Parallel Hedging Preview.md
Outdated
If you want to change the preferred regions for a `CosmosClient` you can do so by callinga new method. | ||
|
||
```csharp | ||
client.UpdatePreferredRegions(new List<string>() { "West US", "East US" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ObservableCollection is also one alternative. https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1?view=netstandard-2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this mutable is risky - in Java we have instead allowed specifying excluded regions (and made that mutable) as well as configurable per request options. Achieves the same - but hasn't the same implications of making preferred regions mutable everywhere
docs/Parallel Hedging Preview.md
Outdated
```csharp | ||
CosmosClientOptions options = new CosmosClientOptions() | ||
{ | ||
SpeculativeProcessor = new ThresholdSpeculator(TimeSpan.FromMilliseconds(500)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is SpeculativeProcessor a public contract CX can add/extend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to have it be a private contract here. I will make it so it's only a private contract.
docs/Parallel Hedging Preview.md
Outdated
The example above will create a `CosmosClient` instance with speculative processing 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. This process will repeat until a request comes back. The SDK will then return the first response that comes back from the backend. The threshold parameter is a required parameter can can be set to any value greater than 0. There are also methods that will allow a user to disable/enabled speculative processing after the client has been created. If you include speculative processing when creating the client it will be enabled by default. | ||
|
||
```csharp | ||
client.DisableSpeculativeProcessing(); // Disables speculative processing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request level granular is also one ASK.
Assuming if we have that then are these APIs at Client scope still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 requestOptions level override definitely is needed - especially for queries (but not just)
docs/Parallel Hedging Preview.md
Outdated
```csharp | ||
RequestOptions requestOptions = new RequestOptions() | ||
{ | ||
LocationToRouteTo = "West US" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be a single Region or Equivalent to PReferredRegions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - why do the opposite of Java (we used excluded regions here) - region to route to as an override owuld allow routing to a region which is not even in preferred regions?
I think it just opens a can of worms
docs/Parallel Hedging Preview.md
Outdated
|
||
```csharp | ||
CosmosClient client = new CosmosClientBuilder("connection string") | ||
.WithSpeculativeProcessing(type: SpeculationType.Threshold, speculativeThreshold: TimeSpan.FromMilliseconds(500)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Speculative/Speculation term everywhere
This has burned us already with Walmart - for customers "speculation" sounds too random. In Java we have used the term ThresholdBasedAvailabilityStartegy or something along those lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like here
WithAvailabilityStrategy(AvailabilityStartegyType.Threshold) or such
docs/Parallel Hedging Preview.md
Outdated
```csharp | ||
CosmosClientOptions options = new CosmosClientOptions() | ||
{ | ||
RegionConsistencyLevel = new ObservableCollection<string, ConsistencyLevel>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow - why is this needed?
docs/Parallel Hedging Preview.md
Outdated
|
||
This will override any logic the SDK does to determine where to route requests and will route the request to the region specified in the `LocationToRouteTo` property. | ||
|
||
## Region Specific Conistency Levels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be really curious why we would want to add this to public API ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed - public API has too many inconsistencies with Java that have been discussed before and are pitfalls.
docs/Parallel Hedging Preview.md
Outdated
```csharp | ||
RequestOptions requestOptions = new RequestOptions() | ||
{ | ||
AvailabilityStrategyFallbackConsistencyLevel = ConsistencyLevel.Eventual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be encapsulated by AvailabilityStrategyOptions
as well right? Also, what are the consistency override semantics here - availability strategy level config overrides request level config overrides client level config?
Pull Request Template
Description
Please include a summary of the change and which issue is fixed. Include samples if adding new API, and include relevant motivation and context. List any dependencies that are required for this change.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber