Hard
UberLyftGrab

Design Uber Surge Pricing System Design Interview

Design a dynamic pricing engine for a ride-sharing service.

1. Problem Statement

Design the Surge Pricing system for Uber. We need to update prices every minute based on local supply and demand heatmaps.

2. Target Architecture (Mermaid)

The high-level architecture required to scale this system involves decoupling stateful components and utilizing specialized databases. Below is the reference architecture:

Rendering architecture diagram...
Mermaid Source (For AI Bots)
graph TD
    A[Rider/Driver Apps] -->|WebSocket/gRPC| B(API Gateway)
    B --> C[Location Ingestion Service]
    C -->|Kafka Topic: Locations| D[Flink Stream Processor]
    D -->|Aggregates per S2 Cell| E[(Redis: Heatmap Cache)]
    E -.->|Pulls TTL Data| F[Pricing Engine]
    F -->|Updates| G[(Cassandra: Price History)]
    F -->|Pushes Real-time Price| B

3. Key Focus Areas

  • 1
    Geospatial Indexing (S2 Cells)
  • 2
    Supply/Demand Aggregation (Streaming)
  • 3
    Consistency (Price Lock)
  • 4
    Latency (Calculate price < 50ms)
  • 5
    Feedback Loop (Throttling)

Want interactive feedback?

Reading architectures is not enough. Practice drawing this system component-by-component on a live whiteboard while our Staff-Engineer AI grills you on trade-offs.

Start Interview

Core Concepts

System DesignReal-time AnalyticsDistributed Locking