← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 036 · Distributed systems

Design Food Delivery Tracking

Medium 50 min

A food delivery app wants customers to watch their courier approach on a live map. At the dinner peak 120,000 couriers are on shift, and each courier's phone sends a GPS position every 4 seconds over a flaky mobile connection. About 400,000 customers have an order in progress and keep the tracking screen open. Positions should reach the customer within 2 seconds, and the app should also show an updated arrival estimate.

Functional requirements

  • Couriers' phones send their position every 4 seconds while on a delivery
  • Customers see their own courier's live position and route on a map
  • Show an estimated arrival time that updates as the courier moves
  • Operations staff can see all couriers in a city

Non-functional requirements

  • A new position reaches the customer within 2 seconds at p95
  • Customers can only see the courier for their own active order
  • Losing an occasional position update is acceptable; showing a stale courier for minutes is not
  • Courier location history is kept for 30 days for disputes

Constraints and scale

  • 120,000 active couriers at peak, 30,000 location updates per second
  • 400,000 customers watching a live map at once
  • Each update is about 200 bytes: courier ID, order ID, coordinates, heading, timestamp

You will practise

  • Push updates to clients over persistent connections instead of polling
  • Keep only the latest position in memory and stream the history elsewhere
  • Route each update to exactly the viewers who care about it
Show 2 hints
  1. 400,000 customers polling every 2 seconds is 200,000 requests per second of mostly 'nothing changed'. What is the alternative?
  2. A customer's connection and the courier's updates probably land on different servers. How do they meet?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • A courier enters a tunnelA courier rides through an underground car park and their phone sends nothing for 90 seconds, then uploads a burst of buffered positions when the signal returns.

Run them from the workspace once your design is in place.