5. Nearby Friends

Medium

Design a scalable backend system for a mobile phone app called “nearby friends” that lets users see which friends are nearby

Functional Requirements
  • Users should be able to see when one of their friends is within some configurable geographical range.
  • List of friends within range should be updated every few seconds
  • The app will allow users to see 10 nearby friends per page and has the option to load an additional 10 friends upon request from the user
  • The app displays nearby friends in order of how close they are (added step)
Nonfunctional Requirements
  • 1000ms latency
  • System should be reliable, but some infrequent data point loss is okay
  • Eventual consistency. The location data store doesn’t need strong consistency.
Assumptions
  • location refresh interval should be no shorter than 60 seconds
  • nearby friend range is configurable by each user
  • The number of concurrent users is 15% of the daily active users
  • The average user of the nearby friends app has 300 friends
  • The app will allow users to see 10 nearby friends per page and has pagination enabled
Estimated Usage
  • 65 million users per day

Seen this question in a real interview before?

Not all editor features are supported on mobile