HLD-324·Transactions & Locking
Hard · 1,500 ptsThree-Sided Food Delivery State Machine & Dasher Offer Lock
Design DoorDash / Uber Eats’ real-time order dispatch coordinator synchronizing customer checkout, kitchen prep state, and exclusive courier offer claims.
Max p99
≤ 105 ms
Availability
≥ 99.4%
Budget
≤ $8,300
Functional Requirements
- FR-1POST /deliveries/{order_id}/claim — Atomically assigns order_id to exactly one courier within offer TTL.
- FR-2GET /deliveries/{order_id}/state — Serves live order state machine to diner, merchant tablet, and courier.
- FR-3DELETE /deliveries/{order_id}/claim — Releases canceled or expired leases/holds atomically and immediately refreshes cached availability.
- FR-4Two couriers must NEVER simultaneously claim the same order_id even during primary DB failover.
Workload Profile
Afternoon Orders40,000 Status Read RPS / 7,000 State/Claim Write RPS
Friday Dinner Rush108,000 Read RPS / 24,000 Concurrent Claim/State RPS
Active Working Set24 GB in-flight delivery state machines & courier locks
Consistency GateStrict serializable courier assignment + RPO = 0 failover
Consistency Model
Strict serializable CAS on courier claim transitions so two drivers never drive to the same pickup.
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words