Garmaine Staff asked 2 years ago

I have a Ridesharing app that is built with the Realtime Database. Like many apps, it tracks user locations and uses those in conjunction with the other users' locations. Scaling research indicates that over 200k connections, with the RDMS I need to plan to implement a concept called "Sharding."

1) I suppose the first thing I thought of was regions, but you probably had the same thought I had: with regions, the borders create a disconnect for users near them.

2) The second thing I thought of was migrating our data operations to Firestore. I have read that Firestore is NOT recommended by Google for location apps, though Geofire (which we use and have had good results with, FYI) has been extended to Firestore supposedly with GeoFirestore. Even Firestore has a cap (though at 1,000,000 that would permit regions in most places and perhaps I could double region the border users).

I'm scratching my head at the moment for issues like folks in bigger cities… I have searched SO to no avail so far for this issue (it's been great on many others, so stick with it SO followers), but my gut tells me the wheel has already been invented for this, so I'm reaching out to you folks for some ideas for a more elegant solution than regions.

Edit: In short, how can I keep everyone with a radius around themselves encompassing everyone in their radius?

Any advice is appreciated. Thank you.