[Azure Cosmos DB][Multi-Write Setup] Does Cosmos DB SDK support cross region retries for transient error codes like 429/410

Soumya Prateek Raul 70 Reputation points Microsoft Employee
2025-07-28T20:51:58.81+00:00

We have a multi-write region setup.

Wanted to know if Cosmos SDK inherently a cross region retries for transient error codes ?

Does the cross region retry kick-in after a single failure or multiple failures ?

Is the cross region retry configurable at the SDK level ?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
{count} votes

Accepted answer
  1. Mahesh Kurva 6,850 Reputation points Microsoft External Staff Moderator
    2025-07-29T18:22:07.73+00:00

    Hi Soumya Prateek Raul,

    Thanks for the response.

    In your response you mention 408 error code is also retried, but in MSFT docs it's mentioned that 408 error code is not retried as these operations are idempotent].

    You're absolutely correct, 408 is not retried for write operations. This is because writes are not always idempotent and retrying them could lead to duplicates.

    User's image

    Reference: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/conceptual-resilient-sdk-applications#timeouts-and-connectivity-related-failures-http-408503

    The SDK retries within the current region first. If persistent failures occur (like the region being unhealthy), the SDK then fails over and retries in another write region, if configured. So, the cross-region retry behavior is conditional on the health of the current region and is an automatic part of the SDK’s design for multi-write setups.

    Azure Cosmos DB SDKs in multiregional environments.

    Do we know how many retries are attempted in same region before going cross region and any way to configure this count ?

    The default max retry count for throttled requests is 9 retries with exponential backoff.

    The SDK also uses a partition-level circuit breaker. By default, if a partition experiences 5 consecutive failures, the SDK marks it as unavailable and begins retrying in another region.

    https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/performance-tips-dotnet-sdk-v3?tabs=trace-net-core#configuration-options

    Hope this helps. Do let us know if you any further queries.

     

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.