Scaling in Azure Cosmos DB
Azure Cosmos DB works with scaling throughput in two ways: provisioned throughput, which is used in the demo, and serverless.
At the time that you create your database, you must decide whether to use provisioned throughput or serverless scaling.
Serverless scalability works well with intermittent workloads, and is coupled with Azure Functions and other Azure serverless offerings. With serverless scalability, you pay on a per-hour basis rather than on RU/s. Serverless accounts aren’t geo-redundant, as they’re limited to one region.
With provisioned throughput, scale settings are configured at the container level. There are two options for scaling container throughput:
- Manual
- Autoscale
The Manual setting for scaling your containers gives you control to set the throughput of the container. This setting works best when for a consistent, steady workload. When you configure a container for manual throughput, you need to set the desired throughput. In our example, we set scaling to 400 RU/s and it consistently stays at 400 RU/s. If the workload gets heavier, we need to adjust the setting manually.
The Autoscale setting works best in cases when traffic ebbs and flows. If you choose Autoscale for your container, you need to specify a maximum number of RU/s for the resource. Your Azure Cosmos DB container can scale from 10% of maximum RU/s to the maximum RU/s.