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 waiting time until responding to a given request. Cosmos DB is a globally distributed service which means that is close to many different countries.
It 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 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 for.
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].
|Notice||When an application consumes more Request Units than we’ve reserved on Collection creation, throttling will occur for the remaining requests.|
Request Unit Monitoring
Azure Portal offers a comprehensive 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.
Cosmos DB offers a transparent way for RUs charges. In the bellow image, we can see 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.
- A Simple Project Using Cosmos DB And Azure App Service
- Let’s talk about Azure Cosmos DB
- Migrate To Cosmos DB