Dashboard/System design/30. Design a Proximity Service/Yelp

SYSTEM DESIGN · LESSON 30 OF 52 · 13 MIN VIDEO · 4 TOPICS

Design a Proximity Service/Yelp

Module Progress (0 / 4 Lessons Completed)0%
System design Track (0 / 52 Modules) · Overall 0/80 (0%)0%
⌁

Narrated HD Video Lesson (13 min) · Pro

Lesson Overview + Section #01 + RESHADED Checklist + Quiz #1 are unlocked free below (no login required). Unlock all 80 HD video lessons and deep-dive sections — or watch our two free sample video lessons first.

SYSTEM DESIGN VIDEO LESSON & GUIDE

Design a Proximity Service/Yelp

Designing a proximity service like Yelp requires answering radial geospatial queries ("coffee within 2 km of (lat, lng)") across 200 million businesses in < 200 ms at 11,600 peak QPS. L4-L6 interviewers evaluate whether candidates recognize why relational BETWEEN range scans and uniform grids degrade under skewed urban density (50,000 POIs in downtown Manhattan vs. 3 in a forest), prove via byte-level math that a global density-adaptive Quadtree occupies only ~4.8 GB of RAM, and choose hash(place_id) scatter-gather sharding with read replicas over hot-spot-prone geographic partitioning.

WHAT YOU WILL MASTER IN THIS LESSON
  • Scope a read-dominated POI proximity service (11,600 peak search QPS vs. infrequent business edits, 200 GB place records, 300 GB/day photos) and justify relaxed eventual consistency (minutes) for index updates.
  • Architect a CQRS split separating relational source-of-truth writes (Primary DB + Blob Store) from a memory-first read path (In-Memory Spatial Index -> Popular Places Cache -> Read Replicas).
  • Compare SQL 2D B-trees, fixed grids, Geohashes, and dynamic Quadtrees (max 500 places/leaf, ~10 tree levels), deriving the exact ~4.8 GB RAM footprint for 200M places.
  • Contrast regional sharding against hash(place_id) sharding across replicated index nodes, including cold Quadtree rebuilds from the database on node failure.
SYSTEMATIC INTERVIEW CHECKLIST · RESHADED + 45-MIN CLOCK

8-Step RESHADED Execution Checklist

Follow this exact sequence from the Intro narration on every system design prompt so you never miss requirements, math, contracts, or the 13-minute deep dive.

0 / 8 Checked
INTERVIEWER SCORECARD · WHAT MAKES A STRONG HIRE?

5 Signals Bar Raisers Grade (L4 vs. L5 Senior vs. L6 Staff)

Senior (L5 / E5 / Senior SDE) Bar — Autonomous Pacing, Depth & Proactive Trade-Offs: Owns the 45-minute clock without prompting, derives every component quantitatively, surfaces failure modes (hot shards, stampedes, dual writes) BEFORE being asked, and defends consistency vs. latency trade-offs.
1. Scoping
✓ STRONG HIRE SIGNAL

Clarifies users, read/write skew, p99 latency, consistency bounds, and explicit non-goals in minutes 2–8.

✗ NO-HIRE RED FLAG

Jumps straight into drawing load balancers and microservices at minute 2 without asking a single question.

2. Right-Sized Design
✓ STRONG HIRE SIGNAL

Starts with the simplest working architecture justified by the math (e.g., 1 NVMe SQL primary + replicas + Redis for 40 writes/s & 3 TB).

✗ NO-HIRE RED FLAG

Recites a memorized Kafka + multi-DC Cassandra diagram that contradicts their own traffic calculations.

3. Technical Depth
✓ STRONG HIRE SIGNAL

Drives deep into 1–2 hard bottlenecks (partition keys, hot-key mitigation, transactional outbox, KV-cache batching) at minute 27.

✗ NO-HIRE RED FLAG

Skims across 12 boxes at identical buzzword depth and runs out of time before the deep dive.

4. Explicit Trade-Offs
✓ STRONG HIRE SIGNAL

Uses 3-part reasoning: 'A queue here because SMTP spikes to 3 s; checkout stays <60 ms, and we accept eventual email delay + retry dedup.'

✗ NO-HIRE RED FLAG

Name-drops tools ('We put Kafka and ZooKeeper here') without stating the alternative or operational cost.

5. Communication
✓ STRONG HIRE SIGNAL

Thinks aloud every 30–45s, checks alignment at phase transitions, and treats 'What if X fails?' as a cue for where points are awarded.

✗ NO-HIRE RED FLAG

Goes silent for 5 minutes while drawing or defends a flawed assumption defensively when nudged.

ARCHITECTURE & DATA-FLOW SLIDES · SLIDE 1 OF 1Section 01: System Design: Yelp
ARCHITECTURE / DATA FLOW DIAGRAM
full scan: too slowYoulat, lng0.4 kmCafe0.8 kmBakery0.6 kmPizza6 kmHotel9 kmGym12 kmMuseumAll places200 million
SECTION 01 OF 4

1. System Design: Yelp

★ FREE PREVIEW
Key Takeaway: A proximity service is fundamentally an in-memory spatial indexing problem: pruning 200 million global places down to a few hundred radial candidates in single-digit milliseconds without ever scanning the full dataset.
ARCHITECTURE / DATA FLOW DIAGRAM
full scan: too slowYoulat, lng0.4 kmCafe0.8 kmBakery0.6 kmPizza6 kmHotel9 kmGym12 kmMuseumAll places200 million

The Radial Proximity Query Problem

When a user opens Yelp or Google Places and searches for "coffee near me", the backend receives a center point (lat, lng), a search radius (e.g., 1,000 m), and an optional category filter, and must return matching businesses inside that circle ranked by distance, rating, and popularity. Across 200 million global places and thousands of concurrent searches per second, computing exact spherical (Haversine) distances against every row on disk takes seconds per request—requiring a spatial index that narrows the candidate set to a tiny local neighborhood in microseconds.

  • Bounding-circle filtering: Businesses within 1 km (cafe, bakery, pizzeria) qualify, while POIs 5-15 km away (museum, airport hotel) must be pruned without inspecting their records.
  • Multi-signal ranking & hydration: Qualifying candidates are scored by distance, average star rating (1-5), and review popularity, then hydrated with business names, hours, and photo thumbnails.
  • Strict interactive latency: Mobile discovery feels sluggish above 200 ms end-to-end, leaving < 20-50 ms for server-side spatial candidate retrieval.

Static POI Proximity vs. Real-Time Moving-Entity Tracking

In the opening minutes of a geospatial interview, strong candidates distinguish static POI proximity services (Yelp, TripAdvisor, hotel/gas-station finders) from high-churn moving-entity trackers (Uber nearby drivers, Find My Friends). Because restaurants and storefronts rarely change coordinates, the spatial index can optimize overwhelmingly for ultra-fast concurrent reads and apply structural edits asynchronously in batches.

CharacteristicProximity Service (`Yelp` / Static POIs)Real-Time Location Tracker (`Uber` Drivers)
Dataset Cardinality~200 million static businesses~5 - 10 million active moving vehicles
Coordinate Write RateVery low (thousands/day new/edited places)Extreme (1 - 2.5 million GPS updates/s)
Read-to-Write Ratio> 1,000 : 1 (overwhelmingly read-heavy)~1 : 10 to 1 : 1 (write-dominated)
Ideal Index Update StrategyRead-optimized Quadtree refreshed asynchronously every few minutesMutable coarse grid / Geohash bucket table updated in-place in RAM
Interview Signal: Clarifying Question Tip: Explicitly stating 'Because storefronts do not drive down the highway at 60 mph, we can optimize our spatial tree for lock-free reads and batch index mutations every few minutes' immediately earns Staff-level design credit.
SECTION 02 OF 4

2. Requirements of Yelp's Design

🔒 PRO SECTION
Key Takeaway: With 100M DAU generating 11,600 peak QPS over a 200 GB core Places dataset (plus 300 GB/day of photos), Yelp prioritizes high availability and < 200 ms search latency while relaxing index consistency to a few minutes.

Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.

SECTION 03 OF 4

3. Design of Yelp

🔒 PRO SECTION
Key Takeaway: Yelp employs a strict CQRS separation: writes land in a relational Primary DB (+ Blob Store for photos) as the single source of truth, while reads execute entirely in memory across Index Servers and a Popular Places Cache, falling back to Read Replicas only on cache misses.

Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.

SECTION 04 OF 4

4. Design Considerations of Yelp

🔒 PRO SECTION
Key Takeaway: A dynamic in-memory Quadtree (<= 500 places per leaf, ~10 levels deep, ~4.8 GB total RAM) solves urban/rural density skew, while sharding by hash(place_id) with read replicas eliminates regional hot spots and enables zero-downtime cold recovery.

Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.

ACTIVE RECALL & TRADE-OFF PROBES

System Design Checkpoint Quizzes (1)

CHECKPOINT QUIZ #1

In "System Design: Yelp" (Static POI Proximity vs. Real-Time Moving-Entity Tracking), how does a production-grade design handle "Coordinate Write Rate" (Real-Time Location Tracker (`Uber` Drivers))?