You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/understand-ru-consumption.md
+32-37Lines changed: 32 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Understanding Request Units Consumption in Azure Cosmos DB
2
+
title: Understanding Request Units Consumption
3
3
description: This article explains how request units are consumed in Azure Cosmos DB with some examples.
4
4
author: richagaur
5
5
ms.author: richagaur
@@ -12,19 +12,20 @@ appliesto:
12
12
- ✅ Apache Cassandra
13
13
- ✅ Apache Gremlin
14
14
- ✅ Table
15
+
show_latex: true
15
16
---
16
17
17
-
# Understand Request Units Consumption in Azure Cosmos DB
18
+
# Understand request units consumption in Azure Cosmos DB
18
19
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.
20
21
This article explains what influences RU consumption, how common operations consume RUs, and practical ways to design efficient workloads.
21
22
22
23
## What influences RU consumption
23
24
24
25
### 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.
@@ -39,10 +40,11 @@ Request Units consumption for an operation scales with document size due to the
39
40
|1,024 KB |145.90 | 625.00 |
40
41
|2,048 KB |291.80 | 1250.00 |
41
42
42
-
*Read RUs mentioned are applicable to session and eventual consistency.
43
+
> [!NOTE]
44
+
> Read RUs mentioned are applicable to session and eventual consistency.
43
45
44
46
### 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).
46
48
47
49
### Configuration choices
48
50
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:
52
54
* Customer managed keys
53
55
* Dynamic data masking
54
56
55
-
### Additional factors
56
-
57
-
#### RU consumption in multi-region accounts
57
+
### RU consumption in multi-region accounts
58
58
When an account has multiple regions, Azure Cosmos DB provisions throughput independently in each region, enabling low latency access and high availability.
59
59
60
60
***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.
61
61
***Read** operations consume RUs in the region they're served from.
62
62
63
63
This model ensures predictable performance and durability while making global distribution transparent.
64
64
65
-
####RU consumption in multi-region write accounts
65
+
### RU consumption in multi-region write accounts
66
66
67
67
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.
68
68
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/).
69
69
70
-
## How Request Units consumption evolves
70
+
## How request units consumption evolves
71
71
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.
73
73
74
74
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.
75
75
76
-
## Document operations and Request Units
76
+
## Document operations and request units
77
77
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.
79
79
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.
82
82
83
83
### Write Operations
84
84
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
87
87
A create operation includes:
88
88
* Inserting the document
89
89
* 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:
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.
108
106
109
107
#### Patch
110
108
111
109
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.
112
110
113
-
**Example:**
114
-
Updating a 1-KB document with two modified indexed terms:
@@ -135,17 +131,16 @@ Point reads (using document ID and partition key) are read operations that are m
135
131
136
132
|**Document Size**|**RUs for point read**|
137
133
|---------|---------|
138
-
|1 KB |1.00 RU |
139
-
|100 KB |~10.00 RUs |
134
+
|1 KB |1.00 |
135
+
|100 KB |~10.00 |
140
136
141
137
#### Feed operations
142
138
Feed operations include Change Feed and Read Feed. These operations return a stream or batch of documents rather than a single document.
143
139
Feed operations consume RUs based on:
144
140
* The number of documents processed
145
141
* The size of those documents
146
142
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.
149
144
150
145
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.
151
146
@@ -171,15 +166,15 @@ Examples include:
171
166
* Delete by partition key
172
167
* Time-to-live (TTL) deletion
173
168
* Unique key reindexing
174
-
*Materialized view (GSI) maintenance
169
+
*Global Secondary Index (GSI) maintenance
175
170
176
171
## Measuring and monitoring RU consumption
177
172
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.
179
174
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.
181
176
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.
183
178
184
179

0 commit comments