I have an atlas project and I am using realm on android, problem is that I installed this app on my device and not elsewhere but in the atlas dashboard, it is showing that I have 11 connections so what does a connection mean and what’s going wrong in my scenario.
Hi @Zaki_Shaikh ,
A connection doesn’t necessarily match the number of clients: the same client can have multiple connections open, and the Sync processes running on the backend need their own connections to MongoDB to perform their functions. For example, as reported in the docs, Sync will keep a change stream open (that translates into a connection) for each synched collection.
There doesn’t seem to be anything wrong, if you have a few collections in your schema, it’s all fine.
Thank you @Paolo_Manna for your support.
now, as you answered that a client can have multiple connections how can I calculate that how many connections my app can have if I have N Databases, N Collections, and N Documents in a Collection.
The number of connections in the client app doesn’t depend on any of that - the client app only talks to the Sync process, that’s the one that in turn has the open connections as discussed in my previous comment.
In general, a client app only needs one connection, especially if only one realm/partition is opened. There are cases when multiple connections can be opened (multiple Realm apps from the same client, flaky connections that need to be re-established, etc.), but it’s reasonable to expect that a single client will typically require a single connection.