Design Live Traffic and ETAs
Drivers keep telling us our arrival times are wrong whenever there is an accident or a jam: we promise 25 minutes and the drive takes 50. We want our routes and arrival estimates to reflect what is actually happening on the roads right now.
This brief is incomplete on purpose, as it would be in a real interview. Ask the interviewer about the users, the features, the targets and the traffic. Whatever you uncover is added below.
Nothing uncovered yet.
Nothing uncovered yet.
Nothing uncovered yet.
- The path from a phone's location report to an updated segment speed
- The data model for segment speeds
- How a route request uses live speeds to answer with an arrival time
- The capacity estimate behind your choices
Works out the report rate (150 million drivers, 480 reports each a day, is about 830,000 a second on average and 3.3 million at peak) and ingests it through stateless collectors into a log partitioned by region, so processing scales out and can fall behind briefly without losing data.
Noisy GPS points are matched to road segments using the sequence of a driver's points (an HMM or similar), in a stream processor keyed by driver or region, before any speed is computed.
Speeds are aggregated per segment over short sliding windows with an outlier-resistant statistic, blended with historical speeds when samples are few, and published every few seconds to a store keyed by segment that routing can read.
The routing engine absorbs new weights every minute without a full rebuild, for example customisable contraction hierarchies (metric-independent preprocessing plus a fast customisation step), and computes the arrival time along the route with live speeds near and predicted speeds further out.
Raw traces expire within 24 hours, only per-segment aggregates are kept, and a segment's speed is published only when enough distinct drivers contributed to it.
Every functional requirement in the brief is visibly served by something on the board, and the non-functional targets are addressed rather than ignored.
Components are labelled, data flows are drawn as connections between them, and the direction of each flow is unambiguous.
Concentrate on turning drivers' phones into live road speeds and on using those speeds for routes and arrival times. Map rendering, place search and turn-by-turn voice guidance are out of scope; assume a routing engine exists that you may redesign.
- Views
- 2