Request Units
Request units are a metering mechanism used by Azure Cosmos DB to ensure fair resource utilization. They help to prevent abuse of the service and ensure that all customers receive adequate performance.
Cosmos DB uses request units to measure the number of requests that a customer is making to the service. The number of request units consumed by a customer depends on the types of operations that they are performing, such as reads, writes, and queries.
Understanding Request Units
Cosmos DB tracks request units per database account. The specific values for each operation (read, write, query, etc.) contribute to the total number of request units consumed.
How Request Units are Calculated
The calculation of request units is based on several factors, including:
- The type of operation
- The size of the data being processed
- The scope of the operation (e.g., database, container, item)
Request Unit Pricing
Pricing for Cosmos DB is based on request units. Consult the Cosmos DB pricing page for current pricing information. You can view your consumption and costs in the Azure portal.
Example: Querying an Item
// A typical query to retrieve a single item. This will consume request units.
// The number of request units consumed depends on the query's complexity.