Design Real-Time Order Dispatch for a Food Delivery Fleet
Last updated: November 29, 2026
Quick Overview
Design the system that assigns delivery partners to food orders across a large city in real time, including batching, handling rejections, and staying up during peak dinner traffic.
Swiggy
November 29, 20260
0
0 solved
Design the system that assigns delivery partners to food orders across a large city in real time, including batching, handling rejections, and staying up during peak dinner traffic.
Dispatch sits at the center of Swiggy's logistics stack and drives cost per order, delivery time and rider earnings. Senior backend candidates are asked to design it end to end; the interviewer checks state modelling, the matching algorithm, data freshness and behavior under load spikes.
What the Interviewer Expects
- Separates location ingestion, order state, and the matching engine
- Uses short batching windows and a cost-based matching rather than pure nearest rider
- Defines a clear order and rider state machine with reliable offer and accept flow
- Partitions work by zone so matching stays fast
- Plans for peak load, degraded modes and region failures
- Names the metrics used to tune the cost function
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you prevent two matchers from assigning the same rider?
- How would you add a second pickup to a rider already en route?
- What happens if the location stream lags by 30 seconds?
- How would you test a new cost function safely?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: accept confirmed orders, choose a rider, send an offer, handle accept, reject or timeout, support batching two orders, and reassign when a rider goes offline. Non-functional: assignment wi...
High-Level Design
- Location service: riders send GPS over a persistent connection to gateways, which publish to Kafka partitioned by zone. A consumer keeps the latest position per rider in Redis with a geo index per z...