Food delivery
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Design food delivery (DoorDash / Swiggy): the 60-second story

    Design food delivery

    8:05 pm, raining in Bengaluru. Half a second to show who can deliver.

    Then promise a time before anything is cooked, and time a partner to meet the food.

    100/s

    orders at the 8 pm dinner peak

    Tiny. The load is reads nobody pays for, an assumed 2,500 feed loads a second, and writes nobody sees, 75,000 GPS updates a second.

    Which restaurants can reach you now?

    Bad: Fresh ETAs per app open

    4,600 candidates each, up to 23M ETAs a second.

    Good: Lists per H3 cell

    Rebuilt every minute, 105,000 ETAs a second, whatever the load.

    Two clocks run in parallel. Only the longer counts.

    Delivery = max(assignment + first mile, prep) + pickup + last mile + gate to door. Here max(2 + 6, 15) + 2 + 12 + 4 = 33 min.

    A model’s mean is late half the time. One fixed buffer is too generous for cafés, too tight for biryani.

    The trick

    If late costs 4× early, promise the 80th percentile: 33 + 0.84 × 6 ≈ 38 min.

    Food ready at 15 min, partner 5 min away. Send when?

    Send now and they idle 10 minutes at the counter, lost to every other order. Send at 10 and they arrive as it’s packed.

    35%

    fewer partner-minutes when one partner carries two

    Two orders from one kitchen: 22 partner-minutes instead of 34. Customer B pays for it, 16 minutes instead of 12.

    Rain night: levers per zone, cheapest first

    1. Batch more; use next-order assignment
    2. Add rain fees and partner boosts
    3. Shrink the radius: 7 km → 5 → 3.5
    4. Throttle busy kitchens, then pause new orders

    Remember

    Precompute who can deliver per H3 cell, promise the 80th percentile, and dispatch just in time, often “not yet”. Orders move by conditional writes and a workflow; rain pulls levers per zone.