Reputation: 565
I am receiving the following error when calling .createDocument()
to insert less than 200 documents in a collection. It typically starts happening around 150th call. I am using the Node.js SDK. There are no other operations running on the database when this happens.
{ code: 429, body: '{"code":"429","message":"Exception: Microsoft.Azure.Documents.RequestRateTooLargeException, message: {\"Errors\":[\"Request rate is large\"]}, request URI: rntbd://10.100.136.85:14900/apps/1240113d-9858-49b9-90cb-1219f9e1df77/services/itsupportrequests-ServerService-1/partitions/d7253667-671b-4f4e-ac84-a13b7d3dbf5a/replicas/130701880511768464p\r\nActivityId: 5726e6b5-7955-4b39-b306-4903b9f69b36"}' }
Upvotes: 2
Views: 2140
Reputation: 2728
This happens when your rate of access exceeds your allowed quota. DocumentDB has a max of 2,000 request units per second per collection. An insert is charged (based on the size of your document, and number of indexed terms). If your insert costs 20 request units, you would be able to do 100 inserts per second. If a read costs 2 request units, you would be able to do 1,000 per second.
If you exceed this, you would receive this error.
The way to get past this is to scale out your application across multiple collections, with each collection getting a max of 2,000 request units per second.
When you receive this exception, you will also receive an HTTP header that will tell you how long to wait before retrying the operation. Honor this wait period and try the operation again.
Upvotes: 4