Hi @John Carlo Teves,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
As we understand that, you are experiencing slower insert items after scaling up the throughput of your Cosmos DB NoSQL database. Your situation involves understanding how partitioning and throughput scaling interact in Azure Cosmos DB and how these factors can affect write performance.
Regarding your question about slower insert items after scaling up the throughput, this could be due to a few reasons. One possibility is that the partitioning of your data is not optimized for the increased throughput. When you scale up the throughput, Cosmos DB will automatically partition your data across multiple physical partitions to handle the increased load. If your data is not evenly distributed across the partitions, this can lead to slower insert times.
To optimize the partitioning of your data, you can try the following steps:
- Choose a partition key that evenly distributes your data across the partitions. This will help ensure that the data is evenly distributed and that the insert times are consistent.
- Use the Azure Portal to monitor the partition distribution of your data. If you notice that the data is not evenly distributed, you can try changing the partition key or adjusting the data distribution. Check for the Partition Key Range Throughput Distribution and Cross-partition request count.
- Scale RU/s up to an appropriate value that balances cost and performance. Experiment with slightly different RU/s levels (e.g., 15K instead of 20K) to see how distribution behaviour changes.
- If you are not already using it, the Cosmos DB SDK Bulk Executor Library optimizes bulk operations by batching and efficiently utilizing provisioned RU/s. Use partition-aware SDK configuration to minimize cross-partition routing.
- If you find performance degrades significantly with multiple partitions and the data volume doesn’t require 20K RU/s, consider lowering the RU/s to a stable single-partition range for bulk operations.
Please refer to the below mentioned links for more information.
https://learn.microsoft.com/en-us/azure/cosmos-db/provision-throughput-autoscale
https://learn.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#physical-partitions
I hope this information helps. Please do let us know if you have any further queries.
If the answer is helpful, please click "Accept Answer" and "Upvote it".