Default retry policy values in azure java SDK

JA 131 Reputation points
2022-11-30T06:10:28.563+00:00

we have a java application in which we use azure java SDK for authentication purpose or to communicate to azure resource manager etc or to communicate with cosmos DB etc.

I want to know if there is any default retry policy used internally in the implementation and if yes then what are the values?

I can see the classes like RetryPolicy and RetryOptions, but I dont find the default values.

Please help me to find out the default retry option values for various Azure related operations through azure SDK.

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,529 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,902 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
1,014 questions
Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2022-11-30T12:55:39.663+00:00

    Hi @JA ,

    Thanks for posting this question in Microsoft Q&A platform and for using Azure Services.

    As I understand from the question, you want to know about the default retry policy values in Azure Java SDK of Cosmos DB. Please correct if my understanding does not comply to your ask.

    MaxRetryAttemptsOnThrottledRequests is set to 3, so in this case, if a request operation is rate limited by exceeding the reserved throughput for the collection, the request operation retries 3 times before throwing the exception to the application. MaxRetryWaitTimeInSeconds is set to 60, so in this case if the cumulative retry wait time in seconds since the first request exceeds 60 seconds, the exception is thrown.

    ConnectionPolicy connectionPolicy = new ConnectionPolicy();  
    connectionPolicy.RetryOptions.MaxRetryAttemptsOnThrottledRequests = 3;  
    connectionPolicy.RetryOptions.MaxRetryWaitTimeInSeconds = 60;  
    DocumentClient client = new DocumentClient(new Uri("service endpoint"), "auth key", connectionPolicy);  
    

    Azure Cosmos DB requests are made over HTTPS/REST when you use gateway mode. They're subjected to the default connection limit per hostname or IP address. You might need to set MaxConnections to a higher value (100 to 1,000) so the client library can use multiple simultaneous connections to Azure Cosmos DB. In .NET SDK 1.8.0 and later, the default value for ServicePointManager.DefaultConnectionLimit is 50. To change the value, you can set Documents.Client.ConnectionPolicy.MaxConnectionLimit to a higher value.

    Reference Link: microsoft.azure.documents.client.connectionpolicy.retryoptions
    performance-tips

    Let me know if this information helps. Please let us know if you have further queries.
    Awaiting your reply. Thanks

    1 person found this answer 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.