Skip to content

Commit 4e88040

Browse files
Merge pull request #234594 from markjbrown/control-plane-throttling-limits
Control plane throttling limits
2 parents a2d4763 + bf7bfb8 commit 4e88040

10 files changed

+79
-42
lines changed

articles/cosmos-db/concepts-limits.md

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: sidandrews
77
ms.reviewer: mjbrown
88
ms.service: cosmos-db
99
ms.topic: conceptual
10-
ms.date: 02/27/2023
10+
ms.date: 04/15/2023
1111
ms.custom: ignite-2022
1212
---
1313

@@ -93,18 +93,46 @@ Depending on the current RU/s provisioned and resource settings, each resource c
9393

9494
¹ 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).
9595

96-
## Control plane operations
96+
## Control plane
9797

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 initial 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 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.
99111

100112
| Resource | Limit |
101113
| --- | --- |
102114
| 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 |
104117

105118
¹ 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 | 500 |
106133

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.
108136

109137
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).
110138

@@ -116,17 +144,15 @@ Here's a list of limits per account.
116144

117145
| Resource | Limit |
118146
| --- | --- |
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 |
122149
| Maximum number of regions | No limit (All Azure regions) |
123150

124151
### Serverless
125152

126153
| Resource | Limit |
127154
| --- | --- |
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 |
130156
| Maximum number of regions | 1 (Any Azure region) |
131157

132158
## Per-container limits
@@ -178,6 +204,8 @@ Azure Cosmos DB supports [CRUD and query operations](/rest/api/cosmos-db/) again
178204
| Maximum response size (for example, paginated query) | 4 MB |
179205
| Maximum number of operations in a transactional batch | 100 |
180206

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+
181209
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.
182210

183211
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
191219

192220
¹ You can increase it by [filing an Azure support ticket](create-support-request-quota-increase.md)
193221

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-
207222
## Limits for autoscale provisioned throughput
208223

209224
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
241256

242257
| Resource | Limit |
243258
| --- | --- |
259+
| Maximum size of a document | 16 MB (UTF-8 length of JSON representation) ¹ |
244260
| Maximum MongoDB query memory size (This limitation is only for 3.2 server version) | 40 MB |
245261
| Maximum execution time for MongoDB operations (for 3.2 server version)| 15 seconds|
246262
| Maximum execution time for MongoDB operations (for 3.6 and 4.0 server version)| 60 seconds|
247263
| 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.
249267

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.
251269

252270
## Try Azure Cosmos DB Free limits
253271

articles/cosmos-db/how-to-manage-database-account.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.service: cosmos-db
66
ms.subservice: nosql
77
ms.custom: ignite-2022, devx-track-arm-template
88
ms.topic: how-to
9-
ms.date: 03/08/2023
9+
ms.date: 04/14/2023
1010
ms.author: sidandrews
1111
ms.reviewer: mjbrown
1212
---
@@ -15,10 +15,10 @@ ms.reviewer: mjbrown
1515

1616
[!INCLUDE[NoSQL, MongoDB, Cassandra, Gremlin, Table](includes/appliesto-nosql-mongodb-cassandra-gremlin-table.md)]
1717

18-
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).
1919

2020
> [!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)
2222
2323
## Create an account
2424

@@ -108,6 +108,7 @@ After an Azure Cosmos DB account is configured for service-managed failover, the
108108

109109
:::image type="content" source="./media/how-to-manage-database-account/manual-failover.png" alt-text="Screenshot of the manual failover portal menu.":::
110110

111+
111112
## Next steps
112113

113114
For more information and examples on how to manage the Azure Cosmos DB account as well as databases and containers, read the following articles:

articles/cosmos-db/how-to-setup-rbac.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: Configure role-based access control with Azure AD
33
titleSuffix: Azure Cosmos Db
44
description: Learn how to configure role-based access control with Azure Active Directory for your Azure Cosmos DB account
55
author: seesharprun
6+
ms.service: cosmos-db
7+
ms.topic: how-to
8+
ms.date: 04/14/2023
69
ms.author: sidandrews
710
ms.reviewer: mjbrown
8-
ms.service: cosmos-db
9-
ms.topic: conceptual
10-
ms.date: 02/27/2023
1111
ms.custom: ignite-2022
1212
---
1313

@@ -39,11 +39,10 @@ The Azure Cosmos DB data plane role-based access control is built on concepts th
3939
## <a id="permission-model"></a> Permission model
4040

4141
> [!IMPORTANT]
42-
> This permission model covers only database operations that involve reading and writing data. It does *not* cover any kind of management operations on management resources, for example:
43-
>
42+
> This permission model covers only database operations that involve reading and writing data. It **does not** cover any kind of management operations on management resources, including:
4443
> - Create/Replace/Delete Database
4544
> - Create/Replace/Delete Container
46-
> - Replace Container Throughput
45+
> - Read/Replace Container Throughput
4746
> - Create/Replace/Delete/Read Stored Procedures
4847
> - Create/Replace/Delete/Read Triggers
4948
> - Create/Replace/Delete/Read User Defined Functions
@@ -91,7 +90,7 @@ The Azure Cosmos DB SDKs issue read-only metadata requests during initialization
9190
- The partition key of your containers or their indexing policy.
9291
- The list of physical partitions that make a container and their addresses.
9392

94-
They don't* fetch any of the data that you've stored in your account.
93+
They **do not** fetch any of the data that you've stored in your account.
9594

9695
To ensure the best transparency of our permission model, these metadata requests are explicitly covered by the `Microsoft.DocumentDB/databaseAccounts/readMetadata` action. This action should be allowed in every situation where your Azure Cosmos DB account is accessed through one of the Azure Cosmos DB SDKs. It can be assigned (through a role assignment) at any level in the Azure Cosmos DB hierarchy (that is, account, database, or container).
9796

@@ -103,6 +102,9 @@ The actual metadata requests allowed by the `Microsoft.DocumentDB/databaseAccoun
103102
| Database | &bull; Reading database metadata <br /> &bull; Listing the containers under the database <br /> &bull; For each container under the database, the allowed actions at the container scope |
104103
| Container | &bull; Reading container metadata <br /> &bull; Listing physical partitions under the container <br /> &bull; Resolving the address of each physical partition |
105104

105+
> [!IMPORTANT]
106+
> Throughput is not included in the metadata for this action.
107+
106108
## Built-in role definitions
107109

108110
Azure Cosmos DB exposes two built-in role definitions:
16.6 KB
Loading
26 KB
Loading
103 KB
Loading

articles/cosmos-db/monitor-reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.author: esarroyo
55
author: StefArroyo
66
ms.service: cosmos-db
77
ms.topic: how-to
8-
ms.date: 12/07/2020
8+
ms.date: 04/14/2023
99
ms.custom: subject-monitoring, ignite-2022
1010
---
1111

@@ -24,7 +24,7 @@ All the metrics corresponding to Azure Cosmos DB are stored in the namespace **A
2424
|Metric (Metric Display Name)|Unit (Aggregation Type) |Description|Dimensions| Time granularities| Legacy metric mapping | Usage |
2525
|---|---|---|---| ---| ---| ---|
2626
| 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 Azure Resource Manager 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. |
2828
| 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. |
2929

3030
### Request Unit metrics
@@ -90,7 +90,7 @@ The following table lists the properties of resource logs in Azure Cosmos DB. Th
9090
| **duration** | **duration_d** | The duration of the operation, in milliseconds. |
9191
| **requestLength** | **requestLength_s** | The length of the request, in bytes. |
9292
| **responseLength** | **responseLength_s** | The length of the response, in bytes.|
93-
| **resourceTokenPermissionId** | **resourceTokenPermissionId_s** | This property indicates the resource token permission Id that you have specified. To learn more about permissions, see the [Secure access to your data](./secure-access-to-data.md#permissions) article. |
93+
| **resourceTokenPermissionId** | **resourceTokenPermissionId_s** | This property indicates the resource token permission ID that you have specified. To learn more about permissions, see the [Secure access to your data](./secure-access-to-data.md#permissions) article. |
9494
| **resourceTokenPermissionMode** | **resourceTokenPermissionMode_s** | This property indicates the permission mode that you have set when creating the resource token. The permission mode can have values such as "all" or "read". To learn more about permissions, see the [Secure access to your data](./secure-access-to-data.md#permissions) article. |
9595
| **resourceTokenUserRid** | **resourceTokenUserRid_s** | This value is non-empty when [resource tokens](./secure-access-to-data.md#resource-tokens) are used for authentication. The value points to the resource ID of the user. |
9696
| **responseLength** | **responseLength_s** | The length of the response, in bytes.|

0 commit comments

Comments
 (0)