Skip to content

Commit ab31c75

Browse files
committed
comments addressed
1 parent e6b3981 commit ab31c75

1 file changed

Lines changed: 32 additions & 37 deletions

File tree

articles/cosmos-db/understand-ru-consumption.md

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Understanding Request Units Consumption in Azure Cosmos DB
2+
title: Understanding Request Units Consumption
33
description: This article explains how request units are consumed in Azure Cosmos DB with some examples.
44
author: richagaur
55
ms.author: richagaur
@@ -12,19 +12,20 @@ appliesto:
1212
- ✅ Apache Cassandra
1313
- ✅ Apache Gremlin
1414
- ✅ Table
15+
show_latex: true
1516
---
1617

17-
# Understand Request Units Consumption in Azure Cosmos DB
18+
# Understand request units consumption in Azure Cosmos DB
1819

19-
Azure Cosmos DB uses Request Units (RUs) as a normalized measure of the resources required to execute database operations. Instead of managing provisioning of resources such as CPU, memory, and I/O independently, RUs provide a simple and consistent way to understand how different operations consume resources. Each operation consumes Request Units reflecting the work performed by the service to execute the request with a focus on trying to ensure predictability.
20+
Azure Cosmos DB uses request units (RUs) as a normalized measure of the resources required to execute database operations. Instead of managing provisioning of resources such as CPU, memory, and I/O independently, RUs provide a simple and consistent way to understand how different operations consume resources. Each operation consumes Request Units reflecting the work performed by the service to execute the request with a focus on trying to ensure predictability.
2021
This article explains what influences RU consumption, how common operations consume RUs, and practical ways to design efficient workloads.
2122

2223
## What influences RU consumption
2324

2425
### Document size
25-
Request Units consumption for an operation scales with document size due to the increased CPU and I/O needed to process larger documents.
26+
Request units consumption for an operation scales with document size due to the increased CPU and I/O needed to process larger documents.
2627

27-
|**Document Size** |**Read Operation*** |**Write Operation**
28+
|**Document Size** |**Read Operation** |**Write Operation**
2829
|---------|---------|---------|
2930
|1 KB |1.00 | 4.95 |
3031
|2 KB |1.04 | 6.29 |
@@ -39,10 +40,11 @@ Request Units consumption for an operation scales with document size due to the
3940
|1,024 KB |145.90 | 625.00 |
4041
|2,048 KB |291.80 | 1250.00 |
4142

42-
*Read RUs mentioned are applicable to session and eventual consistency.
43+
> [!NOTE]
44+
> Read RUs mentioned are applicable to session and eventual consistency.
4345
4446
### Indexing
45-
Indexes improve query performance but increase the RUs consumed by write operations. Indexing only required properties reduces RU consumption for writes and updates while balancing query performance. For more information on how to index only required properties, see [indexing policy](https://learn.microsoft.com/eazure/cosmos-db/index-policy).
47+
Indexes improve query performance but increase the RUs consumed by write operations. Indexing only required properties reduces RU consumption for writes and updates while balancing query performance. For more information on how to index only required properties, see [indexing policy](index-policy.md).
4648

4749
### Configuration choices
4850
Some features require more processing that influences RU consumption, such as:
@@ -52,33 +54,31 @@ Some features require more processing that influences RU consumption, such as:
5254
* Customer managed keys
5355
* Dynamic data masking
5456

55-
### Additional factors
56-
57-
#### RU consumption in multi-region accounts
57+
### RU consumption in multi-region accounts
5858
When an account has multiple regions, Azure Cosmos DB provisions throughput independently in each region, enabling low latency access and high availability.
5959

6060
* **Write** operations consume RUs for writing data in the primary region and for replicating the data to additional regions. As a result, write RU consumption increases with the number of regions configured.
6161
* **Read** operations consume RUs in the region they're served from.
6262

6363
This model ensures predictable performance and durability while making global distribution transparent.
6464

65-
#### RU consumption in multi-region write accounts
65+
### RU consumption in multi-region write accounts
6666

6767
Multi-region write accounts allow write operations across all account regions. RU consumption for document operations follows the same general principles as multi-region accounts, with more processing to coordinate conflicting writes across regions.
6868
Because of this added coordination, the unit price of RUs in this configuration differs from single-region write setups. For current pricing details, see [Azure Cosmos DB pricing](https://azure.microsoft.com/pricing/details/cosmos-db/).
6969

70-
## How Request Units consumption evolves
70+
## How request units consumption evolves
7171

72-
Request Units consumption in Azure Cosmos DB evolves over time as platform efficiency improves through hardware upgrades and service optimizations. These improvements are typically passed on to customers automatically, often resulting in more efficient RU consumption without any application changes. For example, binary encoding of stored data reduced the persisted size of documents, which lowered RU consumption for read operations without requiring any application changes.
72+
Request units consumption in Azure Cosmos DB evolves over time as platform efficiency improves through hardware upgrades and service optimizations. These improvements are typically passed on to customers automatically, often resulting in more efficient RU consumption without any application changes. For example, binary encoding of stored data reduced the persisted size of documents, which lowered RU consumption for read operations without requiring any application changes.
7373

7474
Although specific RU values can change over time, the principles remain consistent and predictable. Customers can achieve better cost efficiency by focusing on the factors that influence RU consumption, including document size, indexing decisions, configuration choices, and access patterns.
7575

76-
## Document operations and Request Units
76+
## Document operations and request units
7777

78-
Request Units are consumed based on the work required to perform an operation. This section explains how RUs are consumed across common document operations, using illustrative examples to highlight the underlying principles.
78+
Request units are consumed based on the work required to perform an operation. This section explains how RUs are consumed across common document operations, using illustrative examples to highlight the underlying principles.
7979

80-
[!Important]
81-
The RU values described in this document are illustrative and reflect how Azure Cosmos DB processes operations at a given point in time.
80+
> [!Important]
81+
> The RU values described in this document are illustrative and reflect how Azure Cosmos DB processes operations at a given point in time.
8282
8383
### Write Operations
8484
Different types of write operations follow similar principles. RU consumption primarily depends on **document size** and **indexed properties**.
@@ -87,9 +87,8 @@ Different types of write operations follow similar principles. RU consumption pr
8787
A create operation includes:
8888
* Inserting the document
8989
* Adding indexed terms defined by the indexing policy
90-
91-
**Example:**
92-
RUs consumed for a 1-KB document with 10 indexed terms in one region:
90+
91+
For example, RUs consumed for a 1-KB document with ten indexed terms in one region:
9392
5.0 (document size based) + 0.2 × 10 (indexing) = 7 RUs
9493

9594
#### Updates (replace)
@@ -99,29 +98,26 @@ Update operations involve:
9998
* Deleting any modified indexed terms
10099
* Inserting any modified indexed terms
101100

102-
**Example:**
103-
Updating a 1-KB document with two modified indexed terms:
101+
For example, updating a 1-KB document with two modified indexed terms:
104102
5.0 (deletion) + 5.0 (insertion) + 0.2 × 2 (index deletion) + 0.2 × 2 (index insertion) = 10.8 RUs
105103

106-
[!Tip]
107-
Updates approximately consume twice as many RUs as creates when only a small number of index terms change.
104+
> [!Tip]
105+
> Updates approximately consume twice as many RUs as creates when only a small number of index terms change.
108106
109107
#### Patch
110108

111109
Patch operations update specific properties within a document. The RUs consumed is similar to a replace operation and scales with the number of modified properties.
112110

113-
**Example:**
114-
Updating a 1-KB document with two modified indexed terms:
115-
5.0 (deletion) + 5.0 (insertion) + 0.2 × 2 (index removal) + 0.2 × 2 (index insertion) + 0.4 * 2 (base charge for patch) = 11.6 RUs
111+
For example, updating a 1-KB document with two modified indexed terms using patch operation:
112+
5.0 (deletion) + 5.0 (insertion) + 0.2 × 2 (index removal) + 0.2 × 2 (index insertion) + 0.4 * 2 (base for patch) = 11.6 RUs
116113

117114
#### Delete
118115

119116
Delete operations includes:
120117
* Deleting the document
121118
* Deleting indexed terms
122119

123-
**Example:**
124-
Deleting a 1-KB document with 10 indexed terms:
120+
For example, deleting a 1-KB document with ten indexed terms:
125121
5.0 (document size) + 0.2 × 10 (index removal) = 7.0 RUs
126122

127123
#### Stored procedures
@@ -135,17 +131,16 @@ Point reads (using document ID and partition key) are read operations that are m
135131

136132
|**Document Size** |**RUs for point read** |
137133
|---------|---------|
138-
|1 KB |1.00 RU |
139-
|100 KB |~10.00 RUs |
134+
|1 KB |1.00 |
135+
|100 KB |~10.00 |
140136

141137
#### Feed operations
142138
Feed operations include Change Feed and Read Feed. These operations return a stream or batch of documents rather than a single document.
143139
Feed operations consume RUs based on:
144140
* The number of documents processed
145141
* The size of those documents
146142

147-
**Example:**
148-
Processing five 1-KB documents through a feed consumes approximately the same RUs as reading those five documents individually.
143+
For example, processing five 1-KB documents through a feed consumes approximately the same RUs as reading those five documents individually.
149144

150145
This design provides predictable, linear scaling: as the volume of data processed increases, RU consumption increases proportionally. RU usage depends on data changes and volume, not on how quickly a client consumes the feed.
151146

@@ -171,15 +166,15 @@ Examples include:
171166
* Delete by partition key
172167
* Time-to-live (TTL) deletion
173168
* Unique key reindexing
174-
* Materialized view (GSI) maintenance
169+
* Global Secondary Index (GSI) maintenance
175170

176171
## Measuring and monitoring RU consumption
177172

178-
Each request to Azure Cosmos DB returns the number of Request Units (RUs) consumed as part of the response. This value is exposed through the RequestCharge property and represents the RUs consumed by that specific operation.
173+
Each request to Azure Cosmos DB returns the number of request units (RUs) consumed as part of the response. This value is exposed through the RequestCharge property and represents the RUs consumed by that specific operation.
179174

180-
For query workloads, RU consumption and performance depend on the query shape and index utilization. Enabling [query metrics](https://learn.microsoft.com/azure/cosmos-db/optimize-cost-reads-writes#metrics-for-troubleshooting-queries) allows you to see how RU consumption is distributed across query execution phases, helping identify opportunities to optimize query performance and reduce RU consumption.
175+
For query workloads, RU consumption and performance depend on the query shape and index utilization. Enabling [query metrics](optimize-cost-reads-writes.md#metrics-for-troubleshooting-queries) allows you to see how RU consumption is distributed across query execution phases, helping identify opportunities to optimize query performance and reduce RU consumption.
181176

182-
To understand RU consumption at a broader level, you can monitor Total Request Units metrics in the Azure portal. This metric shows RU consumption at the container or database level and supports filters like database name, container name, operation type, region, and response status.
177+
To understand RU consumption at a broader level, you can monitor **Total Request Units** metrics in the Azure portal. This metric shows RU consumption at the container or database level and supports filters like database name, container name, operation type, region, and response status.
183178

184179
![Screenshot of Total Request Units metric in monitoring tab of Azure Cosmos DB account.](media/monitor-request-unit-usage/request-unit-usage-metric.png)
185180

0 commit comments

Comments
 (0)