teacher
Sign in

Design a Proximity Service

A Yelp or nearby-places case study comparing geohash, quadtree and S2 for radius search, with read-heavy caching and a plan for updating business data.

35 min6 interactive

Requirements

A proximity service finds places near a location: restaurants near me, ATMs within 1 km. Yelp, Google Maps places and Zomato search all start from this primitive.

Functional:

  • Given a latitude, longitude and radius (500 m, 1 km, 2 km, 5 km, 20 km), return nearby businesses.
  • Business owners add, update and delete their business.
  • Anyone can view a business's details.

Non-functional:

  • Low latency: search results in about 100 ms.
  • High availability, especially for reads.
  • Read-heavy: searches vastly outnumber business edits.
  • Business changes may take until the next day to show up in search. This relaxes the design a lot.

Out of scope: reviews, photos, ranking models, routing and live traffic.

1 of 11