How Azure Cosmos Db decides to reject a request when it exceeds reserved RU?
I am trying to understand how the reserved RU works in CosmosDb. I set it to the minimum (400 RU) for a container. Then I ran a stored procedure to insert 150 documents. The response says that it costs 743 RU to insert those documents.
According to the documentation, that means my execution had to fail with "Request Rate is large" exception. But that's not what's happening. I tried to increase the number of documents to 5000 and it failed. I want to understand what is the policy for that exception? How can I anticipate the failure? Does it have a tolerance threshold? Or am I getting the wrong RU?
When you exceed available RU for a given operation, the operation will complete. This will now leave you "in debt," from an RU perspective. You will now be throttled until you pay off the debt (e.g. you wait for enough time that the allocated RU, over time, is applied to your deficit until you are zero'd out).
Let's say you burned 800 RU for a single operation, at the beginning of a one-second time period, and you only have a 400 RU collection. Your 800 RU operation will complete, but you'll then be throttled for somewhere just shy of 2 seconds (since you only have 400 RU per second, or 800 RU across 2 seconds).