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/concepts-limits.md
+43-25Lines changed: 43 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.author: sidandrews
7
7
ms.reviewer: mjbrown
8
8
ms.service: cosmos-db
9
9
ms.topic: conceptual
10
-
ms.date: 02/27/2023
10
+
ms.date: 04/15/2023
11
11
ms.custom: ignite-2022
12
12
---
13
13
@@ -93,18 +93,46 @@ Depending on the current RU/s provisioned and resource settings, each resource c
93
93
94
94
¹ Serverless containers up to 1 TB are currently in preview with Azure Cosmos DB. To try the new feature, register the *"Azure Cosmos DB Serverless 1 TB Container Preview"*[preview feature in your Azure subscription](../azure-resource-manager/management/preview-features.md).
95
95
96
-
## Control plane operations
96
+
## Control plane
97
97
98
-
You can [create and manage your Azure Cosmos DB account](how-to-manage-database-account.md) using the Azure portal, Azure PowerShell, Azure CLI, and Azure Resource Manager templates. The following table lists the limits per subscription, account, and number of operations.
98
+
Azure Cosmos DB maintains a resource provider that offers a management layer to create, update, and delete resources in your Azure Cosmos DB account. The resource provider interfaces with the overall Azure Resource Management layer, which is the deployment and management service for Azure. You can [create and manage Azure Cosmos DB resources](how-to-manage-database-account.md) using the Azure portal, Azure PowerShell, Azure CLI, Azure Resource Manager and Bicep templates, Rest API, Azure Management SDKs as well as 3rd party tools such as Terraform and Pulumi.
99
+
100
+
This management layer can also be accessed from the Azure Cosmos DB data plane SDKs used in your applications to create and manage resources within an account. Data plane SDKs also make control plane requests during inital connection to the service to do things like enumerating databases and containers, as well as requesting account keys for authentication.
101
+
102
+
Each account for Azure Cosmos DB has a `master partition` which contains all of the metadata for an account. It also has a small amount of throughput to support control plane operations. Control plane requests that create, read, update or delete this metadata consumes this throughput. When the amount of throughput consumed by control plane operations exceeds this amount, operations are rate-limited, same as data plane operations within Azure Cosmos DB. However, unlike throughput for data operations, throughput for the master partition cannot be increased.
103
+
104
+
Some control plane operations do not consume master partition throughput, such as Get or List Keys. However, unlike requests on data within your Azure Cosmos DB account, resource providers within Azure are not designed for high request volumes. **Control plane operations that exceed the documented limits at sustained levels over consecutive 5-minute periods here may experience request throttling as well failed or incomplete operations on Azure Cosmos DB resources**.
105
+
106
+
Control plane operations can be monitored by navigating the the Insights tab for an Azure Cosmos DB account. To learn more see [Monitor Control Plane Requests](use-metrics.md#Monitor-control-plane-requests). Users can also customize these use Azure Monitor and create a workbook to monitor [Metadata Requests](monitor-reference.md#request-metrics) and set alerts on them.
107
+
108
+
### Resource limits
109
+
110
+
The following table lists resource limits per subscription or account.
99
111
100
112
| Resource | Limit |
101
113
| --- | --- |
102
114
| Maximum number of accounts per subscription | 50 by default. ¹ |
103
-
| Maximum number of regional failovers | 10/hour by default. ¹ ² |
115
+
| Maximum number of databases & containers per account | 500 ² |
116
+
| Maximum throughput supported by an account for metadata operations | 240 RU/s |
104
117
105
118
¹ You can increase these limits by creating an [Azure Support request](create-support-request-quota-increase.md) up to 1,000 max.
119
+
² This limit cannot be increased. Total count of both with an account. (1 database and 499 containers, 250 databases and 250 containers, etc.)
120
+
121
+
### Request limits
122
+
123
+
The following table lists request limits per 5 minute interval, per account, unless otherwise specified.
124
+
125
+
| Operation | Limit |
126
+
| --- | --- |
127
+
| Maximum List or Get Keys | 500 ¹ |
128
+
| Maximum Create database & container | 500 |
129
+
| Maximum Get or List database & container | 500 ¹ |
130
+
| Maximum Update provisioned throughput | 25 |
131
+
| Maximum regional failover | 10 (per hour) ² |
132
+
| Maximum number of all operations (PUT, POST, PATCH, DELETE, GET) not defined above | 100 |
106
133
107
-
² Regional failovers only apply to single region writes accounts. Multi-region write accounts don't require or have any limits on changing the write region.
134
+
¹ Users should use [singleton client](nosql/best-practice-dotnet.md#checklist) for SDK instances and cache keys and database and container references between requests for the lifetime of that instance.
135
+
² Regional failovers only apply to single region writes accounts. Multi-region write accounts don't require or allow changing the write region.
108
136
109
137
Azure Cosmos DB automatically takes backups of your data at regular intervals. For details on backup retention intervals and windows, see [Online backup and on-demand data restore in Azure Cosmos DB](online-backup-and-restore.md).
110
138
@@ -116,17 +144,15 @@ Here's a list of limits per account.
116
144
117
145
| Resource | Limit |
118
146
| --- | --- |
119
-
| Maximum number of databases per account | 500 |
120
-
| Maximum number of containers per database with shared throughput |25 |
121
-
| Maximum number of containers per account | 500 |
147
+
| Maximum number of databases and containers per account | 500 |
148
+
| Maximum number of containers per database with shared throughput | 25 |
122
149
| Maximum number of regions | No limit (All Azure regions) |
123
150
124
151
### Serverless
125
152
126
153
| Resource | Limit |
127
154
| --- | --- |
128
-
| Maximum number of databases per account | 100 |
129
-
| Maximum number of containers per account | 100 |
155
+
| Maximum number of databases and containers per account | 100 |
130
156
| Maximum number of regions | 1 (Any Azure region) |
131
157
132
158
## Per-container limits
@@ -178,6 +204,8 @@ Azure Cosmos DB supports [CRUD and query operations](/rest/api/cosmos-db/) again
178
204
| Maximum response size (for example, paginated query) | 4 MB |
179
205
| Maximum number of operations in a transactional batch | 100 |
180
206
207
+
Azure Cosmos DB supports execution of triggers during writes. The service supports a maximum of one pre-trigger and one post-trigger per write operation.
208
+
181
209
Once an operation like query reaches the execution timeout or response size limit, it returns a page of results and a continuation token to the client to resume execution. There's no practical limit on the duration a single query can run across pages/continuations.
182
210
183
211
Azure Cosmos DB uses HMAC for authorization. You can use either a primary key, or a [resource token](secure-access-to-data.md) for fine-grained access control to resources. These resources can include containers, partition keys, or items. The following table lists limits for authorization tokens in Azure Cosmos DB.
@@ -191,19 +219,6 @@ Azure Cosmos DB uses HMAC for authorization. You can use either a primary key, o
191
219
192
220
¹ You can increase it by [filing an Azure support ticket](create-support-request-quota-increase.md)
193
221
194
-
Azure Cosmos DB supports execution of triggers during writes. The service supports a maximum of one pre-trigger and one post-trigger per write operation.
195
-
196
-
## Metadata request limits
197
-
198
-
Azure Cosmos DB maintains system metadata for each account. This metadata allows you to enumerate collections, databases, other Azure Cosmos DB resources, and their configurations for free of charge.
199
-
200
-
| Resource | Limit |
201
-
| --- | --- |
202
-
|Maximum collection create rate per minute| 100|
203
-
|Maximum Database create rate per minute| 100|
204
-
|Maximum provisioned throughput update rate per minute| 5|
205
-
|Maximum throughput supported by an account for metadata operations | 240 RU/s |
206
-
207
222
## Limits for autoscale provisioned throughput
208
223
209
224
See the [Autoscale](provision-throughput-autoscale.md#autoscale-limits) article and [FAQ](autoscale-faq.yml#lowering-the-max-ru-s) for more detailed explanation of the throughput and storage limits with autoscale.
@@ -241,13 +256,16 @@ The following table lists the limits specific to MongoDB feature support. Other
241
256
242
257
| Resource | Limit |
243
258
| --- | --- |
259
+
| Maximum size of a document | 16 MB (UTF-8 length of JSON representation) ¹ |
244
260
| Maximum MongoDB query memory size (This limitation is only for 3.2 server version) | 40 MB |
245
261
| Maximum execution time for MongoDB operations (for 3.2 server version)| 15 seconds|
246
262
| Maximum execution time for MongoDB operations (for 3.6 and 4.0 server version)| 60 seconds|
247
263
| Maximum level of nesting for embedded objects / arrays on index definitions | 6 |
248
-
| Idle connection timeout for server side connection closure ¹ | 30 minutes |
264
+
| Idle connection timeout for server side connection closure ² | 30 minutes |
265
+
266
+
¹ Large document sizes up to 16 MB require feature enablement in Azure Portal. Read the [feature documentation](../cosmos-db/mongodb/feature-support-42.md#data-types) to learn more.
249
267
250
-
¹ We recommend that client applications set the idle connection timeout in the driver settings to 2-3 minutes because the [default timeout for Azure LoadBalancer is 4 minutes](../load-balancer/load-balancer-tcp-idle-timeout.md). This timeout ensures that an intermediate load balancer idle doesn't close connections between the client machine and Azure Cosmos DB.
268
+
² We recommend that client applications set the idle connection timeout in the driver settings to 2-3 minutes because the [default timeout for Azure LoadBalancer is 4 minutes](../load-balancer/load-balancer-tcp-idle-timeout.md). This timeout ensures that an intermediate load balancer idle doesn't close connections between the client machine and Azure Cosmos DB.
This article describes how to manage various tasks on an Azure Cosmos DB account by using the Azure portal.
18
+
This article describes how to manage various tasks on an Azure Cosmos DB account by using the Azure portal. Azure Cosmos DB can also be managed with other Azure management clients including [Azure PowerShell](manage-with-powershell.md), [Azure CLI](nosql/manage-with-cli.md), [Azure Resource Manager templates](./manage-with-templates.md), [Bicep](nosql/manage-with-bicep.md), and [Terraform](nosql/samples-terraform.md).
19
19
20
20
> [!TIP]
21
-
> Azure Cosmos DB can also be managed with other Azure management clients including [Azure PowerShell](manage-with-powershell.md), [Azure CLI](sql/manage-with-cli.md), [Azure Resource Manager templates](./manage-with-templates.md), and [Bicep](sql/manage-with-bicep.md).
21
+
> The management API for Azure Cosmos DB or *control plane* is not designed for high request volumes like the rest of the service. To learn more see [Control Plane Service Limits](concepts-limits.md#control-plane)
22
22
23
23
## Create an account
24
24
@@ -108,6 +108,7 @@ After an Azure Cosmos DB account is configured for service-managed failover, the
108
108
109
109
:::image type="content" source="./media/how-to-manage-database-account/manual-failover.png" alt-text="Screenshot of the manual failover portal menu.":::
110
110
111
+
111
112
## Next steps
112
113
113
114
For more information and examples on how to manage the Azure Cosmos DB account as well as databases and containers, read the following articles:
| TotalRequests (Total Requests) | Count (Count) | Number of requests made| DatabaseName, CollectionName, Region, StatusCode| All | TotalRequests, Http 2xx, Http 3xx, Http 400, Http 401, Internal Server error, Service Unavailable, Throttled Requests, Average Requests per Second | Used to monitor requests per status code, container at a minute granularity. To get average requests per second, use Count aggregation at minute and divide by 60. |
27
-
| MetadataRequests (Metadata Requests) |Count (Count) | Count of metadata requests. Azure Cosmos DB maintains system metadata container for each account, that allows you to enumerate collections, databases, etc., and their configurations, free of charge. | DatabaseName, CollectionName, Region, StatusCode| All||Used to monitor throttles due to metadata requests.|
27
+
| MetadataRequests (Metadata Requests) |Count (Count) | Count of ARM metadata requests. Metadata has request limits. See [Control Plane Limits](concepts-limits.md#control-plane) for more information. | DatabaseName, CollectionName, Region, StatusCode| All||Used to monitor metadata requests in scenarios where requests are being throttled. See [Monitor Control Plane Requests](use-metrics.md#Monitor-control-plane-requests) for more information. |
28
28
| MongoRequests (Mongo Requests) | Count (Count) | Number of Mongo Requests Made | DatabaseName, CollectionName, Region, CommandName, ErrorCode| All |Mongo Query Request Rate, Mongo Update Request Rate, Mongo Delete Request Rate, Mongo Insert Request Rate, Mongo Count Request Rate| Used to monitor Mongo request errors, usages per command type. |
*QueryMetrics* provides details on how long each component of the query took to execute. The most common root cause for long running queries is scans, meaning the query was unable to apply the indexes. This problem can be resolved with a better filter condition.
110
110
111
+
## Monitor control plane requests
112
+
113
+
Azure Cosmos DB applies limits on the number of metadata requests that can be made over consecutive 5 minute intervals. Control plane requests which go over these limits may experience throttling. Metadata requests may in some cases, consume throughput against a `master partition` within an account that contains all of an account's metadata. Control plane requests which go over the throughput amount will experience rate limiting (429s).
114
+
115
+
To get started, head to the [Azure portal](https://portal.azure.com) and navigate to the **Insights** pane. From this pane, open the **System** tab. The System tab shows two charts. One that shows all metadata requests for an account. The second shows metadata requests throughput consumption from the account's `master partition` that stores an account's metadata.
116
+
117
+
:::image type="content" source="media/use-metrics/metadata-requests-by-status-code.png" alt-text="Screenshot of the Insights pane, highlighting the metadata requests graph on the System tab." lightbox="media/use-metrics/metadata-requests-by-status-code.png" :::
118
+
119
+
:::image type="content" source="media/use-metrics/metadata-requests-429.png" alt-text="Screenshot of the Insights pane, highlighting the metadata requests 429 graph on the System tab." lightbox="media/use-metrics/metadata-requests-429.png" :::
120
+
121
+
The Metadata Request by Status Code graph above aggregates requests at increasing larger granularity as you increase the Time Range. The largest Time Range you can use for a 5 minute time bin is 4 hours. To monitor metadata requests over a greater time range with specific granularity, use Azure Metrics. Create a new chart and select Metadata requests metric. In the upper right corner select 5 minutes for Time granularity as seen below. Metrics also allow for users to [Create Alerts](create-alerts.md) on them which makes them more useful than Insights.
122
+
123
+
:::image type="content" source="media/use-metrics/metadata-requests-metrics.png" alt-text="Screenshot of Metrics pane, highlighting the metadata requests for an account and time granularity of 5 minutes." lightbox="media/use-metrics/metadata-requests-429.png" :::
124
+
125
+
111
126
## Next steps
112
127
113
128
You might want to learn more about improving database performance by reading the following articles:
0 commit comments