I’m encountering an issue with CosmosDB while performing a batch upsert operation. The error code 16500 indicates a “TooManyRequests” (429) status, which suggests that the request rate is too high for the provisioned throughput. The full error message is as follows:
{'writeErrors': [{'index': 0, 'code': 16500, 'errmsg': 'Error=16500, RetryAfterMs=82, Details='Response status code does not indicate success: TooManyRequests (429); Substatus: 3200; ActivityId: 2575d098-ea8f-4bf2-a9d3-0da63bdd4d76; Reason: (rnErrors : [rn "Request rate is large. More Request Units may be needed, so no changes were made. Please retry this request later. Learn more: http://aka.ms/cosmosdb-error-429"rn]rn);', 'op': {'q': {'reviewId': '684f0cdb-8823-4e29-a2f5-58980d275ebe'}, 'u': {'$setOnInsert': {'reviewId': '684f0cdb-8823-4e29-a2f5-58980d275ebe', 'org_id': '', 'content': 'Good', 'comment': '', 'usefulness': '', 'date_time': '2024-08-14 12:51:09', 'user_name': 'Asmini Kumar Sahu', 'rating': 5, 'source': 'play_store', 'type': 'review', 'ai_analysis': {}, 'rca': {}, 'emotional_analysis': '', 'sentimental_analysis': '', 'theme': '', 'analyzed': False, 'appVersion': '476.0.0.49.74', 'thumbsUpCount': 0, 'batch_id': 22, 'toxicity_level': '', 'dashboard_id': '66be2bd29587dbbd8762dc13'}}, 'multi': False, 'upsert': True}}], 'writeConcernErrors': [], 'nInserted': 0, 'nUpserted': 0, 'nMatched': 0, 'nModified': 0, 'nRemoved': 0, 'upserted': []}
This error is occurring while trying to save 100 items in a single batch operation. My CosmosDB account is configured with 1000 Request Units (RUs) per second.
I am attempting to upsert 100 items at a time into a CosmosDB container, expecting the operation to complete successfully without any errors. However, I’m receiving the “TooManyRequests” (429) error, which implies that the request exceeds the available RUs.
I expected CosmosDB to handle the batch operation within the provisioned throughput, but it seems that the operation requires more RUs than available. I haven’t yet tried to reduce the batch size or increase the RUs.
Jagdish Songara is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.