DEV Community

Cover image for Concepts of Cosmos DB: Request Unit
Marius
Marius

Posted on

Concepts of Cosmos DB: Request Unit

After the introduction of Cosmos DB and understanding the various way of scaling the "traditional" databases I would like to continue writing about Request Unit, a fundamental topic for pricing and capacity planning in Cosmos DB.

What is a Request Unit (RU)?

According to Microsoft, a Request Unit is a performance currency abstracting the system resources such as CPU, IOPS, and memory that are required to perform the database operations supported by Azure Cosmos DB. Whether the database operation is a write, point read, or query, operations are always measured in RUs.

In simpler terms, RU in Azure Cosmos DB is a measure of the amount of resources required to perform operations on the database. It is a unit that combines the cost of reading and writing data, as well as other database operations like indexing. This is how Azure Cosmos DB charges for database operations. Microsoft defines 1 RU = 1 point read of 1kb.

So, when you make a request to the Cosmos DB database, the number of Request Units needed depends on the complexity and amount of data involved in that operation. For example, a simple read operation might cost fewer Request Units than a complex query or a write operation that involves a lot of data.

Monitoring and Optimization

The Azure Portal provides tools for monitoring the consumption of Request Units for your Cosmos DB account. You could use Azure Monitor Metrics or Diagnostic Logs. Efficient monitoring of these resources guarantees availability, performance (identify and address bottlenecks and inefficiencies in real time) and functionality. Monitoring can be used to optimize queries, indexes, and data models for better performance and cost efficiency (resources are allocated efficiently, reducing unnecessary costs).

In summary, Request Units are a way to quantify the cost of operations in Azure Cosmos DB, helping you understand and manage the resource consumption of your database.

In the next article, I will cover another import concept of Cosmos DB: Provisioned Throughput. You can provision a certain amount of RU/s (Request Units per second) for a container based on your anticipated workload.

Photo by Shubham's Web3 on Unsplash

P.S.

I would love hearing from our tech-savvy community! Have insights, tips, or burning questions? Don't keep them to yourself! Drop your thoughts in the comments below. Let's spark a conversation and learn from each other's experiences in the dynamic world of Azure migration

Top comments (0)