DoorDash Dispatch: Building a Lightning-Fast Delivery System
A food delivery dispatch system matches delivery drivers with orders by evaluating both spatial and temporal factors rather than simply choosing the closest driver. The system must account for continuously shifting variables such as food preparation times, driver locations, travel durations, and order batching opportunities. This dynamic variation of the vehicle routing problem requires balancing decision quality with execution speed, as even optimal assignments become useless if computation takes too long. DoorDash's legacy dispatch system was built as a monolithic engine that managed delivery network state, applied business rules, and handled routing calculations. The primary algorithms possessed roughly quadratic computational complexity, meaning computational load grew significantly faster than delivery volume. During peak operational periods, system demand reached nearly four times the engine's processing capacity. These processing delays forced the system to simplify decision rules and directly degraded real-world delivery performance and customer experience. Horizontal scaling works effectively when tasks can be processed independently, but delivery dispatch involves interdependent optimization decisions. Randomly distributing orders across workers prevents efficient batching of nearby deliveries and can lead to conflicting assignments for the same Dasher. Furthermore, coordinating distributed computations introduces potential system bottlenecks in data preparation and result aggregation. To scale effectively, DoorDash had to solve both an architectural challenge of distributing compute and an organizational challenge of partitioning optimization problems without losing critical relationships.
Read the original ↗Contents
- 01What Does a Dispatch System Actually Do
- 02Why Did the Old System Struggle as DoorDash Grew?
- 03Why Couldn’t DoorDash Just Add More Servers?
- 04Separating Coordination from Heavy Computation
- 05Breaking the Optimization Problem Into Smaller Pieces
- 06How Did DoorDash Replace Such a Critical System Safely
- 07The Improvements
- 08Conclusion
What Does a Dispatch System Actually Do
A food delivery dispatch system matches delivery drivers with orders by evaluating both spatial and temporal factors rather than simply choosing the closest driver. The system must account for continuously shifting variables such as food preparation times, driver locations, travel durations, and order batching opportunities. This dynamic variation of the vehicle routing problem requires balancing decision quality with execution speed, as even optimal assignments become useless if computation takes too long.
- DoorDash refers to its food delivery drivers as Dashers.
- Dispatch decisions rely on both spatial constraints (locations of drivers, restaurants, customers) and temporal constraints (travel time, traffic, food prep estimates).
- Assigning the closest driver can cause unnecessary wait times if food is not yet prepared.
- The dispatch challenge represents a dynamic vehicle routing problem where inputs such as order arrivals and driver locations change constantly.
- Dispatch algorithms must prioritize decision speed alongside decision quality to produce timely, actionable assignments.
Why Did the Old System Struggle as DoorDash Grew?
DoorDash's legacy dispatch system was built as a monolithic engine that managed delivery network state, applied business rules, and handled routing calculations. The primary algorithms possessed roughly quadratic computational complexity, meaning computational load grew significantly faster than delivery volume. During peak operational periods, system demand reached nearly four times the engine's processing capacity. These processing delays forced the system to simplify decision rules and directly degraded real-world delivery performance and customer experience.
- DoorDash's previous dispatch engine was a monolith handling state tracking, business rules, and routing in sequence.
- The dispatch process consisted of candidate generation, route verification, and combinatorial optimization.
- Core algorithms suffered from roughly quadratic computational complexity, quadrupling work whenever input volume doubled.
- Peak operational demand could reach up to four times the dispatch processing capacity.
- Computation latencies caused real-world delivery degradation, such as Dashers traveling away from pickups and ready food sitting idle.
Why Couldn’t DoorDash Just Add More Servers?
Horizontal scaling works effectively when tasks can be processed independently, but delivery dispatch involves interdependent optimization decisions. Randomly distributing orders across workers prevents efficient batching of nearby deliveries and can lead to conflicting assignments for the same Dasher. Furthermore, coordinating distributed computations introduces potential system bottlenecks in data preparation and result aggregation. To scale effectively, DoorDash had to solve both an architectural challenge of distributing compute and an organizational challenge of partitioning optimization problems without losing critical relationships.
- Horizontal scaling functions well for independent requests but falters when calculations share interdependencies.
- Randomly splitting dispatch tasks across separate servers prevents batching nearby orders and risks assigning the same Dasher multiple times.
- Distributing optimization problems can simply shift system bottlenecks to the coordination layer responsible for preparing and aggregating tasks.
- DoorDash had to simultaneously rearchitect systems for distributed compute and redesign how optimization problems were partitioned.
Separating Coordination from Heavy Computation
DoorDash redesigned its dispatch platform by separating it into two independently scalable tiers: a coordinator tier and a compute tier. The coordinator tier manages logistics state and coordinates dispatching, while the compute tier consists of stateless workers running optimization routines, routing evaluations, and ML models. To minimize communication overhead across distributed workers, DoorDash implemented localized payload sharding transmitted over gRPC during each dispatch tick. This architectural design enables horizontal scaling of heavy computation while keeping state management centralized.
- DoorDash re-architected its platform into two independently scalable tiers: the coordinator tier and the compute tier.
- The coordinator tier maintains the overall logistics state, enforces business rules, and aggregates results via a reconciliation step.
- The compute tier consists of parallel workers executing heavy calculations, routing evaluations, optimization routines, and ML models.
- DoorDash uses localized payload sharding over gRPC on each dispatch tick to reduce communication overhead across distributed workers.
- Payloads sent to workers are self-contained, allowing workers to remain stateless regarding the evolving logistics state.
Breaking the Optimization Problem Into Smaller Pieces
DoorDash manages large dispatch optimization workloads by applying hierarchical decomposition to divide the problem into localized geographic clusters. The partitioning process involves rapid pre-clustering followed by centroid-based refinement, allowing individual compute nodes to evaluate possibilities in parallel. Because geographic boundaries do not strictly isolate delivery demand, DoorDash implements a global reconciliation and scoring layer to unify partition results before making final assignments.
- DoorDash introduced hierarchical decomposition to divide large dispatch optimization problems into localized, manageable sub-problems.
- Partitioning begins with rapid pre-clustering to create initial groups and is followed by centroid-based refinement.
- Each geographic partition is processed by an independent compute node, decreasing combinatorial complexity and supporting parallel execution.
- Artificial geographic partition boundaries can cut across interconnected delivery opportunities and routes.
- A global reconciliation and scoring layer resolves boundary overlaps and combines local candidate options prior to final dispatch selection.
How Did DoorDash Replace Such a Critical System Safely
DoorDash safely migrated its critical delivery dispatch engine by utilizing a phased testing strategy. The engineering team first implemented shadow testing to evaluate the new engine against real production traffic without directly affecting active deliveries, enabling behavioral regression analysis. Because shadow testing cannot assess the real-world impact of unexecuted decisions, it was followed by production switchback experiments. These controlled, alternating production tests with fallback safeguards allowed the team to measure live fulfillment outcomes before gradually expanding the rollout.
- Replacing DoorDash's dispatch engine required high safety precautions because any defects could degrade Dasher assignments and increase delivery waiting times.
- The engineering team initially used shadow testing by duplicating incoming production traffic to compare the new engine's decisions against the existing system under real conditions, including peak load.
- Shadow testing supported behavioral regression analysis, ensuring that the new platform maintained dispatch quality while improving performance.
- Due to shadow testing's inability to observe the real-world effects of unexecuted decisions, DoorDash followed it with production switchback experiments.
- Switchback experiments alternated control between the old and new engines under controlled conditions, supported by limited exposure and fallback mechanisms before wider rollout.
The Improvements
DoorDash significantly improved its dispatch platform's capacity, latency, and availability by introducing a distributed computation system. The upgraded system achieved a tenfold increase in processing scale and completed over 99.96% of runs within 20 seconds, maintaining greater than 99.99% availability during peak Super Bowl traffic. This extra capacity allows the system to evaluate broader assignment possibilities rather than pruning searches aggressively under high load. Consequently, DoorDash observed improved Dasher acceptance rates, increased fulfillment efficiency, higher Dasher earnings, and millions in annualized savings.
- Distributing computation enabled a 10x increase in DoorDash's dispatch processing scale.
- Over 99.96% of dispatch runs finished in under 20 seconds, resolving previous multi-minute execution times under heavy load.
- The system maintained over 99.99% availability during Super Bowl spikes, managing a 10% week-over-week peak volume increase.
- Increased capacity enabled broader search spaces during busy periods rather than aggressive pruning.
- The system improvements resulted in higher Dasher acceptance rates, improved Dasher earnings, and millions of dollars in annualized fulfillment savings.
Conclusion
DoorDash redesigned its dispatch platform to efficiently integrate computationally demanding machine learning models into its routing process. The architecture incorporates two model-serving tiers: L1, which runs local evaluations inside compute workers via ONNX Runtime to avoid network latency, and L2, which executes heavier, less frequent policy evaluations on isolated remote clusters. Furthermore, the platform supports a multi-agent reinforcement learning system that dynamically tunes optimizer weights for trade-offs like delivery speed and batching efficiency.
- DoorDash implemented a two-tier model serving architecture for dispatch optimization.
- The L1 tier utilizes ONNX Runtime directly within compute workers to avoid network round-trip latency during frequent evaluations.
- The L2 tier uses isolated remote ML serving clusters to handle heavier, less frequent policy evaluations.
- The platform features a multi-agent reinforcement learning system that dynamically adapts optimizer objective weights, such as delivery speed and batching efficiency.
- The primary impact of the redesigned platform was fundamentally shifting the long-term scalability and trajectory of DoorDash's dispatch system.