I'm new to CosmosDB and I'm trying to grasp the R/U's settings limits.
Situation
Within an ASP.NET Core 2.1 application, I want to insert +/- 3000 documents at once. Looping these items and adding them one by one takes minutes of time. So bulk might be the way to go. I've followed some resources like:
Bulk import data to Azure Cosmos DB SQL API account by using the .NET SDK on learn.microsoft.com
Introducing Bulk support in the .NET SDK
In my code I used the sample code from the blog.
List<Task> concurrentTasks = new List<Task>();
foreach (var entity in entities)
{
entity.Id = GenerateId(entity);
concurrentTasks.Add(Container.CreateItemAsync(entity, new PartitionKey(entity.RoleId)));
}
await Task.WhenAll(concurrentTasks);
Inserting one document costs about 6 R/U's from my local development machine into Azure.
When I provision the default 400 R/U's a second, I quickly get 429 Too Many Requests exceptions. When I switch to Autoscale, it's finished within about 20 seconds without exceptions.
My question is: what if I want to limit the R/U's and still using this concurrentTasks approach, will there be retry handling done by the SDK? Or do I need to write my own 429-retry.