HLD-330·Transactions & Locking
Hard · 1,500 ptsReal-Time Grocery Batch Picking, Live Substitutions & Dispatch
Design an Instacart-style grocery fulfillment backend coordinating in-store shopper aisle-picking batches, probabilistic shelf stockout updates, 60-second customer live item-substitution approvals, and cold-chain delivery window locking.
Max p99
≤ 65 ms
Availability
≥ 99.6%
Budget
≤ $8,850
Functional Requirements
- FR-1POST /v1/stores/{store_id}/orders — Reserves delivery-window capacity, snapshots aisle inventory probabilities, and assigns multi-order shopper batch.
- FR-2POST /v1/orders/{order_id}/substitutions — Pushes real-time out-of-stock replacement proposal to customer and locks payment authorization delta.
- FR-3PATCH /v1/orders/{order_id}/items/{item_id} — Processes customer approve/refund response or timeout fallback with read-after-write shopper sync.
- FR-4Must prevent double-claiming shopper batches or delivery-slot overbooking while surviving regional DB brownouts.
Workload Profile
Steady Store Fulfillment50,000 Catalog & Order Sync Read RPS / 9,500 Scan & Sub Write RPS
Sunday Afternoon Grocery Rush138,000 Read RPS / 24,500 Write RPS
Active Working Set38 GB live store-aisle stock probabilities, active orders & delivery-slot counters
Concurrency GateAtomic slot/batch claiming + sub-second shopper <-> customer state sync
Consistency Model
Strict atomic locking on delivery-slot capacity and shopper batch claim; immediate read-after-write on item substitution state.
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.
Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.
Design Write-up
Write under ### Architecture for Diagram to take that up directly
Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words