AdvancedSystem-Design
45 min
Design a Ride-Hailing Dispatch System
RealtimeGeoOptimizationStreaming
Advertisement
Interview Question
Design real-time driver-rider matching and dispatch with surge pricing, ETA, live location, and fraud detection.
Key Points to Cover
- Geo-indexing: grid/quadtrees, proximity queries, k-NN search
- Matchmaking: supply/demand models, surge calculation
- Streaming ingestion for telemetry; backpressure strategies
- Low-latency updates: pub/sub, websockets, partial updates
- Safety/fraud: anomaly detection, device attestation
Evaluation Rubric
Efficient geo-indexing and proximity search25% weight
Robust matching and surge mechanisms25% weight
Reliable real-time streaming design25% weight
Fraud/safety considerations25% weight
Hints
- 💡Consider eventual vs strong consistency for location updates.
Common Pitfalls to Avoid
- ⚠️**1. Inefficient Geo-indexing:** Relying on simple database queries for proximity search instead of specialized distributed geo-spatial indexing (e.g., Geohash, H3, S2 cells), leading to performance bottlenecks at scale.
- ⚠️**2. Neglecting Data Volume & Velocity:** Underestimating the immense throughput of real-time location updates and telemetry, resulting in an ingestion pipeline that chokes or loses data.
- ⚠️**3. Static Surge Pricing:** Implementing surge pricing based on fixed rules or large geographic zones, which fails to respond dynamically to localized, granular supply-demand imbalances and can lead to suboptimal outcomes.
- ⚠️**4. Lack of Backpressure & Resilience:** Failing to design backpressure mechanisms into streaming pipelines or lacking graceful degradation strategies, causing cascading failures during peak traffic or component outages.
- ⚠️**5. Inaccurate or Stale ETA:** Relying solely on static map data for ETA calculations without incorporating real-time traffic, historical patterns, or predictive models, leading to poor user experience and mismanaged expectations.
Potential Follow-up Questions
- ❓How to prevent driver collusion on surge?
- ❓What about offline areas?
Advertisement