liveBook · Manning

Request unit

As explained in Microsoft Azure in Action

A request unit is Azure Cosmos DB's normalized measure of the computational resources required to perform a database operation.

A request unit (RU) is Azure Cosmos DB’s measure of the resources an operation consumes. Reads, writes, and queries cost different amounts depending on their complexity: reading a 1 KB item might use 1 RU, while a query that filters and sorts several items might use 10 RUs or more. section 11.1

Provisioned throughput is measured in request units per second (RU/s). At 400 RU/s, a collection could handle about 400 of those simple reads each second, or fewer costly operations. More capacity supports more work, but provisioned throughput also affects the bill. section 11.1

C:/> az cosmosdb mongodb collection create 
--account-name alpacacosmosdbaccount --database-name alpacacosmosdb 
--name alpacacontainer --resource-group AlpacaRG
--shard "/alpacakey" --throughput 400

This Azure CLI command creates a MongoDB collection with `--throughput 400`, setting its provisioned capacity to 400 RU/s. section 11.1

When holiday traffic arrives

Autoscaling can accommodate changing demand, but a busy sales period may raise throughput costs. Multi-region replication adds storage and request-unit charges. Monitor RU consumption alongside latency, and set an alert when consumption crosses a chosen threshold so the team can respond before demand becomes a surprise. section 11.1.3 section 11.6.2

C:/> az monitor metrics alert create --name "High RU Consumption" 
--resource-group AlpacaRG --scopes /subscriptions/
{subscription-id}/resourceGroups/AlpacaRG/providers/Microsoft.DocumentDB/
databaseAccounts/alpacacosmosdbaccount 
--condition "avg totalRequestUnits > 900" --window-size 5m 
--evaluation-frequency 1m --action {action-group}

This Azure Monitor CLI example alerts an action group when average `totalRequestUnits` exceeds 900 over a five-minute window, checked every minute. section 11.6.2

How Microsoft Azure in Action covers it

How deep it goes
Explains RU/s with approximate read and query costs, then shows throughput configuration and a consumption alert; it does not detail RU calculation.
Examples
Illustrates consumption with a 1 KB read, a filtering-and-sorting query, a 400 RU/s collection, and an Azure Monitor alert.
What it assumes
Introduces RU/s through simple operations while treating resource groups as previously covered.
What you can do after
Operate/configure it by setting collection throughput and monitoring consumption with an Azure Monitor alert.
How it connects
Connects request units to provisioned throughput, autoscaling, multi-region replication, query optimization, and Azure Monitor.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.