Home/Labs/DoorDash JIT Dispatch Batcher
All 280 Labs
INTERACTIVE LAB🍔

DoorDash Just-in-Time Dispatch Lab (Interactive)

Hold the courier until the kitchen is nearly done, then batch routes without breaking SLAs. Coordinate the three-sided marketplace: predict kitchen prep, dispatch couriers at ready-minus-travel, bundle compatible orders along one route, and watch utilization, idle minutes, and delivery promises move.

Just-in-Time Dispatch & Batching Engine

The 3-sided marketplace: hold the courier until the kitchen is almost done, bundle compatible orders along one route, and keep every delivery inside the 35-minute promise.

Orders per courier run (batch depth)38
Courier-minutes consumed per run238.0 min
Idle waiting at kitchen door0 min — JIT syncs arrival to bag seal
Couriers demand requires157 of 400 online
Fleet utilization39%
ETA vs 35 min promise250 min — BREACH
Batch depth 38 + queue pushes the last delivery to 250 min vs the 35 min promise — shrink the MILP bundling window or add couriers before the food (and ratings) go cold.

How It Works Under the Hood

Food delivery is logistics against perishable clocks. Dispatching a courier the moment an order lands strands them at the restaurant for the entire kitchen prep window — the naive-engineering failure DoorDash, Swiggy, and Zomato all hit. The fix is Just-in-Time dispatch: a gradient-boosted Kitchen Prep Time model forecasts packing minute, an H3 geospatial matcher finds a courier six minutes away, and assignment fires at ready-minus-travel so arrival coincides with the bag seal. On top, MILP batch optimizers bundle compatible orders along one route while holding every customer inside the 35-minute promise.

Core Architectural Principles

  • JIT trigger: dispatch time equals predicted food-ready time minus courier travel, zeroing restaurant-door idle minutes.
  • Batch depth: bundling K orders per run divides courier-minutes by K but adds a detour to each drop beyond the first.
  • Capacity math: Little's law — couriers needed equals orders per minute times occupied minutes per run, versus fleet online.
Interview Round Script

For delivery designs, lead with the three-sided coordination and the naive-dispatch trap, then state the JIT formula out loud: dispatch at KPT minus travel time. Name the batching problem — VRPTW solved heuristically every thirty seconds — and its guardrail: bundle only when both ETAs still fit the promise. Mention the GPS pipeline: MQTT ingest, Redis geospatial buffer, map-matching, WebSocket push with client interpolation.

Key Trade-Offs

Aggressive batching and JIT holding maximize courier utilization and margins but push ETAs toward the promise edge whenever kitchens run late.

Related Curriculum Chapter

DoorDash / Swiggy / Zomato: Food Delivery Logistics & Real-Time Tracking

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs