What is the behavior of queries when there is status code 429?

José Luis Garcia Anticona 26 Reputation points
2023-12-19T22:41:49.4933333+00:00

Hello, good afternoon, in my work as an Azure Cosmos DB modeler and developer, questions arise to understand how Azure Cosmos DB actually responds to queries. One of those questions is:

If the provisioning of resources in cosmos DB is by the number of RUs in one second for one hour, when in my total request metrics 429 errors appear in one minute, what exactly is it?

I know that a query that has 429 did not find sufficient resources and remains on hold and retries, but how do you do that retry? every second? every how many milliseconds?

And the metric that appears is counting the same query that is retried several times as if they were different queries? or the account independently?

Thanks in advance for your response

Kind regards

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

1 answer

Sort by: Most helpful
  1. Sajeetharan 2,261 Reputation points Microsoft Employee
    2023-12-20T05:44:19.2433333+00:00

    Throttling in Cosmos DB occurs when you've used up your allocated Request Units within a one-second window. The resulting 429 status code indicates the duration, in milliseconds, you must wait before retrying your operation

    By default, he Azure Cosmos DB client SDKs automatically retry requests on 429s. If you are using the SDK, You can change the default retry count by setting the RetryOptions on the CosmosClientOptions instance. By default, the CosmosException with status code 429 is returned after a cumulative wait time of 30 seconds if the request continues to operate above the request rate. This error is returned even when the current retry count is less than the maximum retry count, whether the current value is the default of 9 or a user-defined value.

    when in my total request metrics 429 errors appear in one minute, what exactly is it? The metrics indicates the number of throttled requests per minute for the given time range.

    And the metric that appears is counting the same query that is retried several times as if they were different queries? or the account independently? Metrics covers all the queries which have been retried even for multiple times.

    All the answers are covered here in the below links.

    0 comments No comments

Your answer

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