System Design
  • Introduction
  • System Design Process
  • System Design Systematic Approach
  • System Design Topics
  • System Design Interview Tips
  • Object Oriented Design
  • System Design Problems
    • Designing an API Rate Limiter
    • Design News Feed
    • Design Recommendation System
    • Design Photo Sharing App
    • Design Location Based App
    • Design Messenger App
    • Design Twitter
    • Design Uber Lyft
    • Design Surge Pricing
  • Architect's Toolbox
    • Cache Design
    • Database and Cache
    • Pull vs Poll
    • Geo Location
    • Storage Estimation
    • ID Generator
    • Latency Numbers
    • Encoding Decoding Encryption Decryption
  • Systems Design Glossary
    • Consistent Hashing
    • Sharding or Partitioning
    • Database Indexes
    • Proxies
    • Caching
    • Queues
    • SQL vs. NoSQL
    • CAP Theorem
    • Distributed Messaging System
    • Long-Polling vs WebSockets vs Server-Sent Events
    • Producer and Consumer
    • Latency, Bandwidth and Throughput
    • Microservices Architecture
    • RESTful API
    • Concurrent Programming
  • Distributed System Resources
    • Distributed System Notes
  • Reference
Powered by GitBook
On this page
  • Requirements and Goals of the System
  • Scale Estimation
  • Database Schema
  • Each location:
  • reviews, photos, and ratings of a Place
  • System APIs
  • Basic System Design and Algorithm
  • Two different use case:

Was this helpful?

  1. System Design Problems

Design Location Based App

  • Yelp or Nearby Friends

  • Proximity server

Requirements and Goals of the System

Functional Requirements:

  1. Users should be able to add/delete/update Places.

  2. Given their location (longitude/latitude), users should be able to find all nearby places within a given radius.

  3. Users should be able to add feedback/review about a place. The feedback can have pictures, text, and a rating.

Non-functional Requirements:

  1. Users should have a real-time search experience with minimum latency.

  2. Our service should support a heavy search load. There will be a lot of search requests compared to adding a new place.

Scale Estimation

500M daily user * 2 times per day * 5 queries per time / 86400 seconds ~ 50k QPS

Peak hour: * 2 ~ 100k QPS

Assuming 500M places

Database Schema

Each location:

  1. LocationID (8 bytes): Uniquely identifies a location.

  2. Name (256 bytes)

  3. Latitude (8 bytes)

  4. Longitude (8 bytes)

  5. Description (512 bytes)

  6. Category (1 byte): E.g., coffee shop, restaurant, theater, etc.

Total size: 8 + 256 + 8 + 8 + 512 + 1 => 793 bytes

reviews, photos, and ratings of a Place

  1. LocationID (8 bytes)

  2. ReviewID (4 bytes): Uniquely identifies a review, assuming any location will not have more than 2^32 reviews.

  3. ReviewText (512 bytes)

  4. Rating (1 byte): how many stars a place gets out of ten.

System APIs

API for searching

search(api_dev_key, search_terms, user_location, radius_filter, maximum_results_to_return, 
    category_filter, sort, page_token)

Basic System Design and Algorithm

Two different use case:

  • Location of a place doesn’t change that often, we don’t need to worry about frequent updates of the data.

  • Objects do change their location frequently, e.g., people or taxis

PreviousDesign Photo Sharing AppNextDesign Messenger App

Last updated 5 years ago

Was this helpful?