You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/cosmos/azure-cosmos/README.md
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -945,6 +945,84 @@ Per partition automatic failover enables the SDK to automatically redirect write
945
945
only for single write region accounts that have at least one read-only region. When per partition automatic failover is enabled, per partition circuit breaker and cross-region hedging is enabled by default, meaning
946
946
all its configurable options also apply to per partition automatic failover. To enable this feature, follow the guide [here](https://learn.microsoft.com/azure/cosmos-db/how-to-configure-per-partition-automatic-failover).
947
947
948
+
### Cross Region Hedging Availability Strategy
949
+
950
+
Cross region hedging availability strategy improves availability and reduces latency by sending duplicate requests to secondary regions if the primary region is slow or unavailable. The SDK uses the first successful response, helping to mitigate regional outages or high latency.
951
+
952
+
#### Key Concepts
953
+
954
+
-**Hedged Requests**: The SDK sends a parallel request to another region if the primary region does not respond within a configured delay.
955
+
-**Configurable**: Hedging can be enabled or disabled, and the delay before sending a hedged request is tunable.
956
+
-**ThreadPoolExecutor**: The sync CosmosClient instance will use a ThreadPoolExecutor under the hood for parallelizing requests. Users can choose whether to use the default ThreadPoolExecutor the SDK uses, or to pass in their own instance. *The async client does not need the executor since it uses asynchronous logic to parallelize requests.*
957
+
958
+
#### Enabling Cross Region Hedging
959
+
960
+
You can enable cross region hedging by passing the `availability_strategy_config` parameter as a dictionary to the `CosmosClient` or per-request. The most common configuration keys are `threshold_ms` (delay before sending a hedged request) and `threshold_steps_ms` (step interval for additional hedged requests).
0 commit comments