Service Limitations
On this page
- Overview
- Aggregation
- Atlas
- Batch Loading
- Federated database instances
- Serverless Instances
- Sharded Clusters
- Time Series Collections
- Private Endpoints
- Change Streams
- Database Commands
- Device Sync
- Concurrent Workloads
- Default Message Size Limit
- Pause Due to Inactivity
- MongoDB Version Requirements
- HTTP Version Requirement
- Query Options
- Query Results
- Request Traffic
- Connection Pooling
- Static Hosting
Overview
Atlas App Services has several guidelines to keep in mind when architecting how your tools and clients interact with MongoDB through App Services. Keep this guidance in mind when deciding how to structure queries, selecting which CRUD and aggregation operations to use, and determining how to handle concurrent workloads.
Aggregation
App Services supports all aggregation pipeline
stages in
system functions except for $currentOp
and $indexStats
.
For security reasons, only a subset of aggregation pipeline stages are supported in user functions.
For a list of pipeline stages that are available and their allowed function context, see Aggregation.
Atlas
Batch Loading
When data is bulk/batch loaded into MongoDB Atlas, you may see a delay in data appearing on devices while App Services processes changes.
Federated database instances
You can link a Federated database instance to your app as a MongoDB data source. However, there are some caveats to keep in mind when working with Atlas Data Federation:
Federated data sources do not support write operations.
You can only access a Federated data source from a system function.
You cannot connect to a Federated data source via the wire protocol.
You cannot define roles and permissions for a Federated data source.
You cannot set a read preference for a Federated data source.
You cannot create a database trigger on a Federated data source.
You cannot use a Federated data source as your app's Device Sync cluster.
Serverless Instances
You can link a serverless instance to your app as a MongoDB data source. However, serverless instances do not currently support change streams, so the following features are limited:
You cannot create a database trigger on a serverless instance.
You cannot use a serverless instance as your app's Device Sync cluster.
You cannot watch collections for changes data sources that are serverless MongoDB Atlas instances.
Sharded Clusters
Atlas Device Sync does not currently support sharded MongoDB Atlas clusters. However, you can add a sharded cluster as a data source and access it from a function.
Time Series Collections
Time series collections do not yet support change streams. Therefore, you cannot define triggers on a time series collection.
You can use time series collections with Atlas Device Sync, but only Data Ingest is supported.
Private Endpoints
App Services supports private endpoints for securely connecting to an AWS Virtual Private Cloud with AWS PrivateLink. Apps must be deployed locally to a region in AWS to use a private endpoint. App Services does not support private endpoints for Global Apps or Apps deployed to GCP or Azure. For more information, see Private Endpoints.
Change Streams
App Services limits the total number of change streams open against a given cluster across all Apps based on the cluster's size. The following table lists the limitations for each cluster size:
Cluster Size | Maximum Number of Change Streams |
---|---|
Free Tier ( M0 ) | 5 |
Shared Clusters ( M2 /M5 ) | 10 |
Small, Dedicated Clusters ( M10 /M20 ) | 100 |
Standard Clusters ( M30 /M40 ) | 1000 |
Standard Clusters ( M50 - M90 ) | 1000 |
High-Power Clusters ( M100+ ) | 1000 |
Note
App Services opens a single change stream on each collection that is associated with a Database Trigger or Device Sync operation.
Important
Usage Recommendation
To minimize the number of open change streams:
Start Sync operations only when necessary. Close any open Sync streams immediately when they're no longer necessary.
Avoid data models that require you to Sync an unbounded number of collections.
Database Commands
App Services does not support any database commands in the Client SDKs or Functions. You can, however, call a limited subset of database commands when when connected to a MongoDB cluster over the wire protocol. For a list of supported commands, see Database Commands.
Device Sync
Concurrent Workloads
You can have up to 5,000 concurrent Sync connections. See Request Traffic.
- Writing:
- For improved performance, you may want to limit the number of concurrent writes to a single MongoDB document. App Services has no hard limit to the number of users concurrently writing data to a MongoDB document. However, with more than 30 concurrent writers, you may see delays in syncing or conflict resolution.
- Reading:
- Frontend clients reading from a global realm can scale past tens of thousands of concurrent users.
Tip
Scalability
When you intend to have many concurrent writers, have each writer work on a separate document.
Default Message Size Limit
Device Sync has a default message size limit of 20 MB compressed for any messages sent from the client application. The message size depends on the compressed size of changes sent from the client device. For more information about changesets and the compression that Sync uses, refer to Changeset.
The compressed size of a changeset is not directly equivalent to the size of any document in the upload. In practice, however, the changeset size is generally on the same order of magnitude of the size of documents in the upload.
This limit acts as a countermeasure against connections consuming too many resources.
You may see this limit as an error message similar to failed to read: read
limited at 20971521 bytes
.
You can request a higher limit by filing a support ticket.
Pause Due to Inactivity
After 30 days with no activity, Device Sync pauses. Refer to Re-Enable Sync for information about how to re-enable Device Sync.
MongoDB Version Requirements
You can access most of the CRUD and Aggregation functionality of MongoDB version 3.6 with the MongoDB service; however, App Services does not support all operations and features available in standard tools and clients. For a list of specific MongoDB operations that are available when you connect to MongoDB through App Services, see the CRUD & Aggregation API reference.
Device Sync requires MongoDB Atlas clusters to run specific versions of MongoDB. Flexible Sync requires MongoDB 5.0.0 or greater.
HTTP Version Requirement
Data API and HTTPS Endpoints require HTTP/1.1 or greater when making requests.
Query Options
App Services supports all query options in system functions. App Services does not support certain options for CRUD operations run from user functions. For a list of specific options that are available when you connect to MongoDB through App Services, see Query Options.
Query Results
MongoDB queries executed through App Services can return a maximum of 50,000 documents. If you need to return more documents, consider paginating your query.
Request Traffic
App Services limits request traffic to the following defaults:
10,000 concurrent requests. Any requests made beyond the non-Sync concurrent request limit receive an HTTP response status code of 429 - Too Many Requests.
5,000 concurrent Device Sync connections.
App Services can handle requests many times the above limits. However, these limits are put in place to ensure applications scale responsibly and to prevent DOS attacks and unintended billing charges.
You can request a higher limit by filing a support ticket.
Connection Pooling
App Services uses connection pooling to reduce the overhead of frequently opening and closing connections between requests and trigger executions. Connections are opened as needed. Connection pooling is dependent on several factors:
Cluster Tier. The higher the cluster tier, the more connections available in the pool.
Deployment Mode. Global deployments use multiple servers in each region, and therefore have an overall larger connection pool.
Services. Each service has an independent connection pool, so the number of services in your app does not impact the number of connections available.
Static Hosting
App Services enforces a 25MB maximum file size constraint on static hosting.
Important
Static Hosting is deprecated. Learn More.