Quick revision
The short answer
Location ingestion fell behind and processed a backlog in order, so the index held positions 25 seconds old and dispatch matched riders with drivers who had already left. To prepare, we keep only the latest update per driver and drop superseded ones, record location age so dispatch skips stale drivers, partition ingestion and dispatch by city and pre-scale the busy city from last year's demand curve, shape demand with surge pricing, visible wait times and capped client retries, degrade on purpose with wider batches and cached ETAs, and rehearse with a game day at about 15 times normal peak.
What to remember
In this answer, we saw that bad New Year's matches came from stale positions: ingestion processed a backlog in order, so the index was 25 seconds behind. Keeping only the latest update per driver and recording location age keep dispatch on fresh data. Partitioning by city and pre-scaling from last year's curve isolate the spike, surge pricing, visible waits and capped retries shape demand, deliberate degradation protects trip transitions and payments, and a game day at about 15 times peak proves the preparation.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Location ingestion fell behind and processed a backlog in order, so the index held positions 25 seconds old and dispatch matched riders with drivers who had already left. To prepare, we keep only the latest update per driver and drop superseded ones, record location age so dispatch skips stale drivers, partition ingestion and dispatch by city and pre-scale the busy city from last year's demand curve, shape demand with surge pricing, visible wait times and capped client retries, degrade on purpose with wider batches and cached ETAs, and rehearse with a game day at about 15 times normal peak.
Why this question is asked
New Year's Eve is the most predictable spike a ride-hailing service has: the date, the time and the cities are known a year ahead. Yet it regularly causes trouble, because the load is not just higher, it is concentrated in one minute in a few places. Interviewers ask this scenario to see whether a senior engineer can trace bad matches back to stale data, and prepare a whole stack, not just add servers. In this answer, we will explain what failed, then fix location freshness, isolate cities, shape demand, plan deliberate degradation, and rehearse for the night.
1A Quick Recap of What Happened
At midnight, trip requests in one city jumped from 1,500 to 14,000 per minute, about ninefold. At the same time, more drivers came online and many apps sent updates more often, while riders retried failed requests. Location update lag reached 25 seconds, meaning the location index showed where drivers had been 25 seconds earlier. Dispatch matched riders with drivers who, in reality, had already driven away, so ETAs were wrong, offers were declined or cancelled, and riders requested again, adding more load.
2Why Stale Locations Caused Bad Matches
Location updates flowed through a queue to the ingestion workers, which processed them in order. When updates arrived faster than workers could process them, the queue grew, and every update waited behind all the older ones. A driver's newest position was only applied after 25 seconds of older positions for that driver and everyone else had been processed, even though those older positions were already useless.
This is the key insight: for current location, only the latest update per driver matters. Processing a backlog in order is right for payments or trip events, but wrong for positions. In 25 seconds at 50 km/h a car travels about 350 metres, enough to be on the wrong side of a junction or a closed street.
| Approach | Work during the spike | Age of positions used |
|---|---|---|
| Process every update in order | All updates, including superseded ones | Grows with the backlog: 25 s |
| Keep latest per driver, drop superseded | One update per driver per batch | Seconds, even under load |
| Plus location age check in dispatch | Stale drivers skipped | Never older than the limit |
3Fix 1: Keep Only the Latest Position and Track Its Age
Ingestion should conflate updates: keep a map from driver id to the newest update, overwrite it as new updates arrive, and periodically write the current contents to the index. When load is high, superseded updates are simply dropped. Ten updates from one driver during a busy second become one write. Kafka partitions keyed by driver id help, because all of one driver's updates go to the same worker, which can conflate them in memory.
Every position in the index carries its timestamp, so dispatch can compute location age and skip drivers whose position is older than a limit, say 10 seconds, or rank them lower. A match with a slightly smaller pool of fresh drivers is much better than a match with a driver who is not there.
4Fix 2: Isolate Cities and Scale Ahead
One regional stack served every city, so the busiest city's spike also slowed ingestion and dispatch for its neighbours. Partitioning ingestion and dispatch by city, separate Kafka partitions or topics, separate worker pools and separate dispatch owners, means one city's spike cannot starve the others. Large cities can be split further into cells.
Because the date is known, we scale ahead. Last year's demand curve for each city tells us when the spike starts and how high it goes; we scale the busy cities' ingestion, dispatch and trip capacity to that level plus a margin an hour before midnight, rather than waiting for autoscaling to react while the spike is happening.
- Rider and driver appsretry caps and backoff built in
- Edge and admission controlper-city request limits, queue with visible wait
- Per-city ingestion workersKafka partitions by city, latest position only
- Per-city dispatch ownerbatch matching, location age check
- Shared trip and payment servicescapacity reserved for transitions and payments
5 layers, from the top down. Step through them one at a time.
5Fix 3: Shape Demand Instead of Only Absorbing It
Even with perfect systems, there are far fewer drivers than riders at midnight. Surge pricing raises prices where demand exceeds supply, which reduces requests and brings more drivers to the area. Showing realistic wait times, such as about 15 minutes, lets riders decide whether to wait, walk or take the metro, instead of requesting again and again.
Requests that cannot be matched immediately should wait in a fair queue rather than fail and be retried. And client retries must be capped, with backoff and jitter, and honour any wait time the server sends. Otherwise each failed request becomes three or four requests, and the system spends its capacity on retries.
6Fix 4: Degrade on Purpose
Some work can be made cheaper during the peak. Batch windows for matching can widen from one second to two or three, which gives better matches and fewer computations per request. ETA ranking can use cached ETAs between grid cells instead of fresh routing calls. Non-critical features, such as trip history, promotions and in-app ratings, can pause. The capacity saved goes to what matters most: trip state transitions and payments, which must never fail, even if new requests have to wait.
7Rehearsing for the Night
Preparation is proven, not assumed. A few weeks before, we run a game day that replays the city's demand curve at about 15 times its normal peak against the production-like stack, with realistic driver location traffic and client retries. Dashboards show location age, dispatch latency, offer acceptance rate and match quality, the signals that went wrong this year. On the night itself, an on-call team is staffed and watching those dashboards, with runbooks for each degradation step and the authority to apply them.
8Follow-up questions
Why not simply add more ingestion workers?
More workers help, but as long as updates are processed in order, any backlog makes every position stale. Conflating to the latest position per driver removes the backlog by design: the work per second depends on the number of drivers, not the number of updates, so the system stays fresh even when updates arrive faster than expected.
Why does location age matter more than location accuracy here?
GPS positions are usually accurate to a few metres, so accuracy is rarely the problem. Age is: a position 25 seconds old can be hundreds of metres off for a moving car. Tracking age lets dispatch decide which positions are still useful, which accuracy alone cannot tell it.
How do you choose the 15 times peak for the game day?
From last year's actual spike in that city, around nine to ten times normal, plus growth and a safety margin. Testing well above the expected peak shows where the next bottleneck is, so we know the margin we have on the night.
9Conclusion
In this answer, we saw that bad New Year's matches came from stale positions: ingestion processed a backlog in order, so the index was 25 seconds behind. Keeping only the latest update per driver and recording location age keep dispatch on fresh data. Partitioning by city and pre-scaling from last year's curve isolate the spike, surge pricing, visible waits and capped retries shape demand, deliberate degradation protects trip transitions and payments, and a game day at about 15 times peak proves the preparation.
Open with
The bad matches came from stale data. Location updates queued up and were processed in order, so the index held positions 25 seconds old, and dispatch matched riders with drivers who had already left.
Then, if they want more
For current location only the newest update per driver matters, so I would conflate: keep the latest update per driver, drop superseded ones instead of working through a backlog, and store each position's timestamp so dispatch skips drivers whose location is older than, say, 10 seconds.
Then I would isolate cities: partition ingestion and dispatch by city so one city's spike cannot starve others, and scale the busy city ahead of time from last year's demand curve, an hour before midnight. I would shape demand with surge pricing and visible wait times, queue requests fairly and cap client retries with backoff, because retries multiply load.
I would plan degradation in advance: wider batch windows, cached ETAs for ranking, pausing non-critical features like trip history, and keeping capacity for trip transitions and payments.
And I would rehearse with a game day at about 15 times the city's normal peak, with dashboards for location age, dispatch latency and offer acceptance, and a staffed on-call plan for the night.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What failed during the New Year's Eve spike, and how do you prepare dispatch, location...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/88006b76a4/