System Design Problems
Design Uber
Uber serves 100M+ monthly active users across 70+ countries with real-time ride matching, location tracking, and dynamic pricing. This design covers geospatial indexing, dispatch systems, and ETA estimation.
- Scale â 100M+ MAU, 19M trips/day, 5M+ drivers
- Latency â Driver matching < 5 seconds
- Real-time â Location updates every 4 seconds
Uber's core challenge is solving the real-time matching problem at global scale with sub-second latency.
Requirements Clarification
Functional Requirements
- Request a ride and get matched with a driver
- Real-time driver location tracking
- ETA calculation for pickup and dropoff
- Dynamic pricing (surge pricing)
- Trip management (start, end, payment)
- Driver availability management
- Rating system for riders and drivers
Non-Functional Requirements
- Availability: 99.99% uptime
- Latency: Match driver < 5 seconds
- Consistency: Strong for location, eventual for payments
- Scale: 5M concurrent drivers, 100K ride requests/minute
Back-of-the-Envelope Estimation
High-Level Architecture
Geospatial Indexing: S2 Geometry
Matching Algorithm
Surge Pricing
Trip State Machine
Data Model
Practice Exercises
- Geospatial: Design a system to find all drivers within 5km of a rider. What data structure would you use?
- Matching: How would you handle the case where a driver rejects a ride offer? Design the retry logic.
- Surge: Design a surge pricing algorithm that doesn't frustrate riders but balances supply/demand.
- Scale: How would you handle 10x traffic during New Year's Eve?
What to Learn Next
-> Design Airbnb Marketplace and booking systems.
-> Design Amazon E-commerce at scale.
-> Design WhatsApp Real-time messaging systems.
-> Design Leaderboard Sorted sets and ranking.
-> Saga Pattern Distributed transactions.
-> Idempotency Handling duplicate requests safely.