Design a driver queue for a pickup area
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Uber's system design round, last asked Feb 2026. It tests queues, geofencing and fairness.
Design an internal service for a ride-hailing company that keeps a queue of drivers for each pickup area, such as an airport pickup zone or a staging lot. A driver who enters the area joins that area's queue. A driver who leaves the area, goes offline or becomes ineligible is removed. Internal services, such as the dispatcher, query an area's current queue and see the drivers in order.
Requirements
- Functional: add a driver when they enter an area; remove them when they leave, go offline or become ineligible.
- Functional: return an area's queue in order, and a driver's position in it; let dispatch take the driver at the front.
- Non-functional: location and status events arrive at high volume and may be late, duplicated or out of order; a driver must never be in two queues or be offered the same trip twice; queues must survive a server failure; reads must be fast.
Clarifying questions
- How is entering and leaving an area detected: geofence events from the location service, or explicit check-ins?
- What sets the order: time of entry only, or priorities such as vehicle type or a penalty for declining a trip?
- Does a driver who briefly leaves the geofence, for example due to GPS noise, lose their place?
- How many areas and drivers per area? How often is the queue read?
- Does a driver keep their place if the app restarts?
What a strong answer covers
- APIs:
GET /areas/{id}/queue,GET /drivers/{id}/position, a dequeue or claim call for dispatch, and the event consumer for enter, leave, offline and ineligible events. - Data model: per area, an ordered structure keyed by entry time plus a driver-to-area index, so a removal is O(log n) and a driver is in one queue at most.
- Event ingestion from a stream partitioned by area, with idempotency (event ids) and version or timestamp checks so a late "enter" cannot undo a newer "leave".
- Ordering rules: entry time as the base, a grace period for brief geofence exits, and where priorities would fit.
- Consistency: one owner per area (a partition leader or a lock), so concurrent dispatchers cannot both claim the front driver.
- Fault tolerance: state in a replicated store or rebuilt from the event log; what happens during failover.
- Observability: queue length, time-in-queue, event lag, and alerts on stuck queues.
Follow-ups
- The airport wants drivers who decline a trip to move back five places. How do you implement it?
- The location service sends a burst of late events after an outage. How do you avoid scrambling the queues?
- Show drivers their position and an estimated wait in the app.
- Two terminals share one staging lot. How do you model the areas?
Where it's asked
- Uber · System design · Last asked Feb 202660 min · Whiteboard and discussion
What it tests
queues · geofencing · fairness
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
