Preparing your design workspace

Loading the problem and your latest saved attempt…

Nearby Restaurant Search Service

Design a location search service that returns nearby restaurants in stable distance order.

Problem statement

For this exercise, assume a user supplies a latitude and longitude and requests open restaurants within a ten-kilometre radius. Results are ordered by distance and restaurant identifier, support stable cursor pagination, and reflect location changes within five minutes.

Exclude reviews, recommendations, reservations, and delivery logistics.

What to build

  1. Return open restaurants within ten kilometres, ordered deterministically by distance and identifier.
  2. Continue a result set from an opaque cursor without repeating or skipping unchanged rows.
  3. Allow an operator feed to add, move, close, or reopen a restaurant.

At scale

  • Assume 12 million restaurants and 40,000 peak nearby queries per second.
  • Restaurant location or open-state updates peak at 2,000 per second.
  • The first result page should normally complete within 250 milliseconds at the 95th percentile.