In this post, we are going to discuss about an important concepts called Throughput. Throughput simply means how many requests the cosmos DB can serve at a time.
Throughput is measured in terms of a unit called Request Unit or RU. For a simple read query the RU will be 1, setting it as a standard. Heavier insert or update operation is costlier compared to a simple read, therefor will cost more RU’s. RU’s are the determining factor when it comes to the final cost of the cosmos db.
For example, if we run the following query in azure portal, from the example we come across in our previous post, you can see the RU’s in the Query Stat tab.
Cosmos DB offers three kinds of throughputs
- Provisioned Throughput (Mannual) — Here a fixed no.of RU’s will be allocated (say 4000RU’s/second). This type is useful when we exaclty know how much RU’s we will be consuming every month.
- Provisioned Throughput (Automatic) — Here also a fixed no.of RU’s will be allocated, but the scaling will happen automatically
- Serverless — Here we are not provisioning any RU’s. We only need to pay for the RU’s we consume.
When you manually provision a fixed no.of RU’s and when the request exceeds that we get a HTTP 429 error. i.e, Requests are “throttled”
Thanks for reading!