Thank you for reaching out regarding optimizing bulk operations for Cosmos DB.
Currently, the limit of 100 sub-requests per bulk request in Cosmos DB cannot be increased. However, there are a few strategies you can consider optimizing your operations:
Parallel Execution: You can run multiple bulk operations in parallel to speed up the process. This can be achieved by using asynchronous programming and parallel tasks in your Azure Function.
Partitioning: Ensure that your data is well-partitioned. Cosmos DB performs better with operations distributed across multiple partitions.
Throughput Management: Adjust the throughput (RU/s) of your Cosmos DB container to handle the increased load during bulk operations. This can help in processing requests faster.
Efficient SDK Usage: Make sure you are using the latest version of the Cosmos DB SDK, which includes performance improvements and optimizations for bulk operations.
Batching Logic: Implement custom logic to batch and process items in chunks that align with the bulk request limit, ensuring efficient use of resources.
Continue Using Bulk Mode with Parallelization:
• While each bulk request can handle up to ~100 items, you can parallelize multiple bulk requests within your Azure Function.
• Use asynchronous programming with Task. When All (if using C#) or equivalent parallel execution in your language to dispatch multiple batches concurrently.
• This maintains performance and avoids overwhelming the Cosmos DB throughput limits.
Use Azure Data Factory or Change Feed:
• For very large, infrequent migrations or processing, Azure Data Factory with Cosmos DB connector can help with bulk ingestion or deletion scenarios.
• For deletes, you might even use a Change Feed processor to detect items to delete and process them asynchronously at scale.
Hope this helps. Please do let us know if you have any further queries.