Share via


Azure Cosmos DB : Few words about RUs (Request Units) in Cosmos DB

Introduction

In this post, we learn how to measure up Cosmos DB performance, how to monitor this service and finally how we can calculate the consumption.
So, performance can be measured in two ways: latency, and throughput.

Latency is the wait time until responding to a given request. Cosmos DB is a globally distributed service which means that is close to many different countries.
Also supports a range of consistency levels, which allow controlling further the latency.

Throughput measures the number of requests that the service can handle in a specific period of time. Cosmos DB gives to any application a number of request units per second and these depend from the selected Service Tier when deployed the data container in Cosmos DB.

Request Units

Request units are a simple way to manage throughput and ensure predictable performance. In simple words, there is no need to reserve the resources like CPU, Memory, Disk IO, Network IO. 
Request units are not requested but requests are charged in the form of request units because every request is different. For every request, Cosmos DB will tell how many RU that request consumed and was charged.
The identical requests will always require the same number of RUs.

When we create a new Cosmos DB Collection we reserve the number of the RUs that we need to be serviced [See the below image].

Note

When consumed more RUs than we've reserved on Collection creation, will be occurred throttling on the requests.

 

Request Unit Monitoring

Resources Monitoring

Azure Portal offers a very well Dashboard for Azure Cosmos DB resources monitoring. Actually, we can monitor with graphs and charts data for Throughput, Storage, Availability, Latency, Consistency, System and of course we can have a detailed overview of the service.

Consumption Monitoring

Cosmos DB offers a transparent way for RUs charges.  The image shows an example after a query execution Azure shows the charge for this.

Scale Up Request Units

From the Azure Portal, a user can also modify the RUs throughput depending on his needs. This can be achieved from the main blade Collections - Scale, change the Throughput value, e.g 400 and click Save.

Calculating RUs (Request Units )

Microsoft offers a cost estimator web tool for requested unit consumption.
Open the web tool from here, and start calculations to see what will be the cost for the project.

Conclusion

Azure Cosmos DB offer to users a service with many possibilities and also the way to predict the requested units cost consumption with tools. 

See Also 

Microsoft Documents

Technet Wiki Documents