Design Nearby Friends

In a recent interview a friend was asked to design Facebook's/Snapchat's "Nearby Friends" feature. His design included a Poller in the client app that intermittently polls the server for nearby friend locations in a particular radius. The client would also send its location in the background to the server intermittently (only if you're moving). My friend discussed using geohashes instead of latitude/longitudes.

The interviewer wasn't impressed.

I think the interviewer was looking for:

  • If each user has an avg of 500 friends and we're working at Facebook scale, would polling be a right fit?
  • How would you filter out friends outside your given radius? Would u keep doing this at every poll at Facebook scale?
  • How about pushing nearby friends location to client app?

Note there are YouTube videos about Yelp/Uber system design that talk about persistent connections etc., but I don't think any video solves the problem at scale. Thoughts?

Comments (12)