← Back to All Questions
Hard~50 minLocation-Based Services

Design ETA Prediction Service

UberLyftDoorDashGoogle MapsGrab

📝 Problem Description

Design an ETA (Estimated Time of Arrival) prediction service for ride-sharing or delivery. Account for traffic, weather, historical patterns, and real-time conditions.

👤 Use Cases

1.
User wants to requests ride so that sees driver ETA
2.
User wants to tracks delivery so that sees real-time ETA
3.
System wants to updates traffic so that recalculates ETAs

✅ Functional Requirements

  • Calculate ETA between two points
  • Account for real-time traffic
  • Consider historical patterns
  • Update ETA as trip progresses
  • Handle multiple transport modes
  • Provide confidence intervals

⚡ Non-Functional Requirements

  • ETA calculation < 100ms
  • Prediction accuracy within 10%
  • Handle 100K ETA requests/sec
  • Real-time traffic updates (< 1 min)

⚠️ Constraints & Assumptions

  • Traffic is dynamic and unpredictable
  • Map data can be outdated
  • GPS can be inaccurate

📊 Capacity Estimation

👥 Users
10M daily trips
💾 Storage
10TB (road segments, traffic, ML models)
⚡ QPS
ETA requests: 100K/sec, Traffic updates: 10K/sec
📐 Assumptions
  • 10M trips per day
  • Average 10 ETA calculations per trip
  • 1M road segments
  • Traffic update every minute per segment

💡 Key Concepts

CRITICAL
Graph-based Routing
Road network as weighted graph, A* for optimal path.
CRITICAL
Segment Travel Time
Predict time per road segment using ML.
HIGH
Traffic Speed Tiers
Bucket traffic into levels (free flow, moderate, heavy).
HIGH
ETA Recalculation
Update ETA as driver progresses and conditions change.

💡 Interview Tips

  • 💡Start with the routing algorithm (A*, Dijkstra)
  • 💡Discuss the traffic data integration
  • 💡Emphasize the ML model for predictions
  • 💡Be prepared to discuss caching strategies
  • 💡Know the tradeoffs between accuracy and latency
  • 💡Understand the map data requirements