Design a Proximity Service

Quick Overview

Design a service to find nearby places, people, or events. Cover geospatial indexing (geohash, quadtree), efficient radius queries, ranking by relevance, and handling location updates at scale.

Meta
System Design
Software Engineer
Meta
Software Engineer
Onsite
System Design
Medium

0


Design a service to find nearby places, people, or events. Cover geospatial indexing (geohash, quadtree), efficient radius queries, ranking by relevance, and handling location updates at scale.

This appears in Meta's system design onsite, close to products like Nearby Friends, local business search on Facebook, and event discovery. The interviewer checks whether you can pick a geospatial index, serve radius queries at high QPS with low latency, and handle a write-heavy stream of location updates.

What the Interviewer Expects
  • Clarify functional scope (places, people, events) and latency targets
  • Produce a capacity estimate that separates read QPS from location update QPS
  • Choose and justify a geospatial index such as geohash or quadtree
  • Explain how radius queries handle cell boundaries and neighbor cells
  • Address privacy, freshness, and ranking of nearby results
  • Discuss sharding and caching of hot regions
Key Topics to Cover
Geohash
Quadtree
Radius queries
Location updates
Sharding
Caching
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you handle dense areas like Manhattan versus sparse rural areas?
  • How would you keep moving users' locations fresh without overloading the database?
  • How do you rank results beyond pure distance?
  • What changes if users can opt out of sharing their location at any moment?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional Requirements:

  • Nearby Places: Users can search for nearby places based on their current location.
  • Nearby People: Users can find other users within a specified radius.
  • **Nea...
Capacity Estimation

Assuming Meta has around 3 billion users:

  • Active Users: 10% (300 million) active users at peak.
  • Location Queries: If each user makes 5 queries per day, that results in 1.5 billion queries ...

Submit Your Answer
Markdown supported