Skip to content
SD-27 · System design

Design a ETA and Location Sharing

Asked at Staff level45 minutes
Our answers stay hidden until you reveal them.

Design two connected parts of a ride-hailing app. Location sharing: while a trip is on, the rider, and anyone they share the trip with, watches the driver’s car move on a map. ETA: the app shows how many minutes until pickup and until arrival, and the dispatch system asks for the ETA of many nearby drivers to pick the best one for each request.

At peak about 1.6 million drivers are online, each sending its position every 4 seconds: 400,000 location updates a second. Half are on a trip, watched by about a million people, and the system answers about 160,000 ETA questions a second. The car on the rider’s map must be no more than 2 seconds behind the last position we received, and an ETA must come back in under 200 ms, which rules out searching a road graph of millions of junctions from scratch every time. ETAs must also reflect today’s traffic, not the speed limit.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1How often does a driver send its position?
  2. 2Who can see the car?
  3. 3How fresh must the map be?
  4. 4What ETAs are needed?
  5. 5How fast and how accurate?
  6. 6Does traffic matter?
  7. 7Is it global?
  8. 8Do we keep location history?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough