I have recently asked a question about sharding data in RTDB that works fine. However, the scaling to go over the Firebase limitation is still an issue.
Let's take an example :
- User A has its user record in DB1.
- User B has its user record in DB2.
- User A has started a conversation in DB1 with User B.
- User C has started a conversation in DB2 (with the shard system) with User B.
In such case we have load balanced the DBs. But we still have the problem of simultaneous connections.
That means User B should be connected in both DB right ? On another hand, the record of User A is in DB1, the record of User B in DB2. If the user A needs to see if user B is online, he also needs to connect to DB2 etc...
The conclusion so far is that the number of database instance doesn't matter to scale. It will definitely not help bypassing the 200k simultaneous connections as every user will probably be connected to every DB instance.
The only way i was thinking of is to have many real time databases that have all the same data, updated with Cloud functions... This way only, users could connect to any DB (and only 1 especially !) and be able to see the same data as another user connected to another DB.
Is it necessary to do such extreme thing ? Am i missing something that makes me say such conclusions ?