Design the architecture for Uber - the world's largest ride-hailing platform operating in 10,000+ cities across 70+ countries with 130 million monthly active users. Your design must cover:
- Real-time driver matching - when a rider requests a ride, find the optimal driver within 15 seconds. The matching considers distance, ETA, driver rating, vehicle type, and predicted demand. Uses geospatial indexing over millions of active drivers.•Live location tracking - every active driver sends a GPS update every 4 seconds. The system ingests millions of location updates per second, updating a real-time geospatial index.•Surge pricing - dynamically adjust fares based on supply (available drivers) and demand (ride requests) per geographic zone. Recalculated every 30 seconds.•ETA prediction - predict arrival time using real-time traffic data, historical patterns, and ML models. ETA must account for road conditions, events, and weather.•Trip lifecycle - request → match → driver en route → pickup → in-trip → dropoff → payment → rating. Each state transition is an event in an event-sourced system.•Payments - process payments across 70+ countries with different payment methods, currencies, and tax rules.•Driver/rider safety - real-time trip monitoring, anomaly detection (unexpected route changes), and emergency SOS.
The core challenge is the real-time geospatial system operating at global scale with sub-second latency requirements.
Design Uber's ride-hailing platform - real-time matching, surge pricing, ETA prediction, and global dispatch for 100 M+ users. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Mobile Clients -> DNS -> Load Balancer -> API Gateway -> Core Service -> Primary NoSQL DB -> Replica SQL DB -> Redis Cache