BLUEPRINT #04Location & Geospatial
Design a Real-Time Ride-Sharing Dispatch Service (Uber/Lyft)
Referenced Architecture Primitives (4)
Click any primitive to study its algorithmic deep dive10-Stage Structure:1. Requirementsβ2. Sizingβ3. Topologyβ4. Data Modelβ5. AWS Topologyβ6. Deep-Diveβ7. Failuresβ8. SRE Playbooks
1. Problem Statement & Scope
System Mission
Design a real-time, highly available, low-latency ride-matching and dispatch platform (similar to Uber or Lyft) capable of tracking millions of active drivers sending continuous GPS coordinates, matching rider requests with the nearest available drivers in under 2 seconds, calculating dynamic surge pricing, and handling atomic ride acceptances under high concurrency.
Functional Requirements
- Real-Time Driver Location Ingestion: Ingest live GPS coordinates (
lat,lng,bearing,status) from 1 Million active drivers every 4 seconds. - Ride Request & Driver Discovery: Riders request a ride specifying pickup and dropoff coordinates; system discovers top nearby available drivers within a radius in .
- Atomic Ride Dispatch & Match Acceptance: Dispatch ride offers sequentially or in batched rings to drivers; ensure exactly one driver accepts the ride without race conditions.
- Dynamic Surge Pricing: Calculate real-time supply vs. demand multiplier per spatial grid cell (e.g. surge).
- Trip State Machine: Track trip lifecycle states (
REQUESTED,MATCHED,ARRIVING,IN_TRIP,COMPLETED,CANCELLED).
Non-Functional Requirements (SLAs/SLOs)
- High Availability: uptime SLA for location ingestion and dispatch pipelines.
- Ultra-Low Latency: P99 Location Ingestion Latency ; P99 Driver Matching Latency .
- Consistency: Strong consistency on driver acceptance (atomic lock) to prevent double-booking.
- Scalability: Support active drivers and daily completed trips.
2. Capacity & Scale Estimation
Traffic Calculations
- Active Driver Count: 1 Million active drivers ().
- GPS Ingestion Rate: Each driver emits a location ping every 4 seconds ().
- Global Ingestion QPS:
- Peak Ingestion QPS ( rush hour): .
- Rider Demand & Search QPS:
- ride requests per day.
- Active rider search QPS: (Peak ).
Storage & Bandwidth Estimation
- Location Payload Size:
driver_id(16 Bytes),lat(8 Bytes),lng(8 Bytes),bearing(4 Bytes),timestamp(8 Bytes),status(4 Bytes) (with JSON/Protobuf envelope ).
- Ingestion Network Bandwidth:
- Active Driver Ephemeral Location Cache (Redis Geospatial / In-Memory MemoryDB): (Easily stored in memory with sub-millisecond query latency).
- Historical Location Audit Log (30-Day Retention in S3):
3. AWS-First High-Level Architecture
Interactive Architecture DiagramSynthesizing vector architecture diagram...
Part 2: Production Deep-Dive Locked1 Coin = 24 Hours
Unlock Complete Architecture & Production Runbooks
Your Balance:40 Coins
You have explored the free architectural preview (~42%). Spend 1 Coin to unlock the remaining 7 production deep-dive sections for a full 24 hours.
Sections Included in This 24-Hour Pass:
4. API Interface Design
5. Data Models & Storage Architecture
6. Component Deep Dives & Workflows
7. Architectural Trade-Off Matrix & Primitive Links
8. Critical Edge Cases & Distributed Failure Modes
9. Production Pitfalls & Anti-Patterns (The "Gotchas")
10. Production Runbook & Operational Best Practices
Keeps page unlocked for exactly 24 hoursSpend coins to fund LLM & compute infrastructure