I develop a Mac app that uses the Realm Swift SDK and Device Sync. The backend is an M20 cluster. The data model for this app has 8 collections.
Question:
I am trying to determine how many users can simultaneously run this app and still sync to/from the backend cluster. I’ve read the limitations page here: https://www.mongodb.com/docs/atlas/app-services/reference/service-limitations/, which says the M20 cluster has 100 maximum “change streams” and that one stream is opened for each collection.
So, 100/8 = 12.5.
But I already have more than 12 users running my app simultaneously and sync appears to function just fine. Does the Realm SDK open and close sync connections automatically as-needed? Or, once I open the Realm when my app launches, is a persistent sync session (and therefore 8 change streams) held forever, until the Realm is closed?
I cannot find a simple answer to a very basic question: how many simultaneous users of the Realm Device Sync SDK can the M20, M30, and M50 tiers support?
And a related question: what happens if the number of users grows and there is contention for “change streams”? Will all users eventually have their sync requests filled?
Those limits are for database connections; Realm Sync doesn’t connect directly to your cluster but rather goes through an Atlas App Services instance which in turn connects to the Atlas cluster via a pool of connections. So there’s no hard limit on the number of users active, but there are of course some hardware limits (I.e. the hardware itself can’t support trillions of concurrent connections).
And yes, in the unlikely scenario that you hit the limit the cluster connection limits, eventually all sync requests will be handled.
Thanks! Do you have any idea how many simultaneous sync clients an M20 can handle, roughly? I don’t need an exact number, just a ballpark so I know approximately when I’ll need to upgrade to the next tier.
@Bryan_Jones long ago, I had a similar situation, here was my learning, but let me know if this helps ?
Unfortunately, there is no straightforward answer to this question as the number of simultaneous sync clients an M20 cluster can handle depends on various factors such as the size and complexity of the data being synced, the network bandwidth, and the hardware capacity of the client devices.
However, MongoDB Atlas provides a feature called Performance Advisor that can help estimate the capacity of your cluster for your workload by analyzing the cluster usage and providing recommendations. Additionally, you can consider load testing your app and measuring the performance to get an idea of how many simultaneous sync clients your M20 cluster can handle.
It’s important to note that tuning the sync settings such as batch size, sync frequency, and conflict resolution policy can also improve the sync performance and capacity of your sync clients.
Yup, I can follow up here. We are planning on trying to release some formal numbers around performance on various cluster sizes, but it is difficult since there are so many factors at play including:
Cluster Size
Deployment model (Local vs. Global, what Local region you are in compared to your atlas cluster)
Data Model
Permissions Model
Quantity of data (both number of documents and size of documents)
Rate of changes
So we will follow up when our work on trying to formalize some numbers is completed but in the meantime testing it yourself is sometimes the best way to do this. We find that in general the best way to do this is to use the NodeJS driver since it can be easier to implement a realistic load test.
Yea, I get that there will be variation. But having even SOME guidance would help a lot because what I’m trying to do is estimate costs for a client. I just need a ballpark estimate. Can an M20 cluster handle 100 sync users? 200? 1000? 10000?
Just having an order-of-magnitude answer would be enough to project rough backend costs, which is what I’m trying to do.
Thats fair. For some ballpark calculations from some of our existing customers. I suspect an M20 should be able to handle somewhere between 1,000-10,000 clients at the same time. We have some customers that push those bounds, but generally, they increase their cluster tier due to throughput as they hit the 10,000’s and then they can push through that to higher numbers.
Additionally, we have some customers that are at around 1 million daily active users (but note that does not mean 1 million clients active at the same time, just over the course of a day)