Lesson 5 of 14
❮Prev Next❯

MSD-101 · Global taxi booking design

What breaks, and how the design survives

⏱ 12 min 🎮 Hands-on ☁ Azure

5of 14

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    ⚡ The 30-second answer

    Good mobile designs are judged by what happens when things fail. A taxi app must survive network drops mid-request (idempotency + outbox), expired tokens (silent refresh, replay once), killed driver apps (location expiry, honest status), region outages (Front Door failover) and surges (queue + autoscale).

    • Five failures every ride app meets
    • What the user sees
    • The fix for each
    • Prove it in the playground

    Try it

    Play with the design before you read about it. Everything runs on this page.

    Pick a failure. Watch it without the fix, then with it.

    Rider app✕Front Door✕Trip service✕Cosmos DB

    Result: The first request did arrive. Two trips, two drivers, two card holds.

    1. The problemOn New Year’s Eve at 00:05, bookings jump tenfold, a region has a network issue, and half the drivers’ phones are on 5% battery. The on-call engineer has 30 minutes.
    2. The design ideaPlan the failure before you write the happy path.
    3. In real lifeTeams that run game days (breaking things on purpose in a test environment) find most of these problems before their users do. The playground on this page is a small game day.

    Start with a question

    On New Year’s Eve at 00:05, bookings jump tenfold, a region has a network issue, and half the drivers’ phones are on 5% battery. The on-call engineer has 30 minutes.

    Every one of those failures is predictable. The design decides whether users notice.

    Explain it like I'm 10

    A good school bus plan says what to do if it rains, if a bus breaks down, or if the road is closed. You do not wait for the rain to make the plan.

    The technical explanation

    Network drops mid-booking. Save the command in the outbox with an idempotency key, retry with backoff (1, 2, 4, 8 s, max 5), and let the server return the existing trip for a repeated key.

    Token expires mid-trip. On a 401, refresh once with the refresh token, hold other calls, replay the failed call once, and log out only if the refresh fails.

    Driver app killed. The driver’s Redis entry expires after 30 s, so matching skips them; the rider sees “location paused, last seen 20 s ago”; the trip is reassigned after 2 minutes.

    Region down or 10× surge. Front Door moves traffic to another region; Cosmos DB has a replica there and Redis refills from the next pings. For surges, queue booking commands, autoscale Container Apps on load, rate-limit per user and show an honest “high demand” screen.

    FailureUser sees without the fixThe fix
    Network dropTwo drivers, two chargesIdempotency key + outbox
    Token expiryLogged out mid-rideRefresh once, replay once
    App killedFrozen car on the map30 s expiry + honest status
    Region down“Service unavailable”Front Door failover
    10× surgeEndless spinnerQueue + autoscale + rate limit

    💥 Break it☁ Simulate on Azure🎮 Playground

    Real-world scenario

    Teams that run game days (breaking things on purpose in a test environment) find most of these problems before their users do. The playground on this page is a small game day.

    Ready for more?The full lesson adds the technical explanation, interview questions and quick revision.

    Test yourself

    5 questions. Get 4 right and this lesson is marked complete.

    1. 1. The access token expires mid-trip. What should the app do?
    2. 2. A driver’s app is killed by the OS. What stops new offers going to that phone?
    3. 3. Which is the correct retry schedule?
    4. 4. A whole region fails. What moves traffic?
    5. 5. During a surge, why turning off idempotency checks is wrong?

    Pass the quiz to complete this lesson.

    Next: AI inside the app, and AI-written code →

    Questions people ask

    What happens to a taxi app when an Azure region goes down?

    Azure Front Door health probes move traffic to a healthy region. Cosmos DB already has a replica there, and the Redis driver index refills from the next GPS pings, so riders can keep booking.

    How should a mobile app retry a failed request?

    Reuse the same idempotency key, wait longer each time with jitter (1, 2, 4, 8 s) and stop after about 5 tries in a state the user can see. Fast, endless retries drain the battery and cause a retry storm.

    What should the app show when the backend is down?

    An honest status (“We are having trouble, your request is saved”), keep the command in the outbox, retry in the background with backoff, and never ask the user to tap again.

    Interview questions

    How this topic comes up in system design interviews. Answer out loud first, then open the model answer.

    beginner What is an idempotency key?

    A unique ID the client sends with a command and reuses on every retry, so the server can return the first result instead of doing the work twice.

    intermediate How do you avoid a retry storm after an outage?

    Exponential backoff with jitter on the client, a maximum number of tries, rate limits in API Management, and a queue in front of the expensive work.

    advanced How would you test these failures before launch?

    Game days in a staging region: cut network on test phones, expire tokens early, kill driver apps, fail a region with Front Door, and load-test 10× traffic, checking the user-facing screens and the metrics each time.

    Quick revision

    Remember

    • Five failures every ride app meets
    • What the user sees
    • The fix for each
    • Prove it in the playground
    • Every retry loop needs three things: the same idempotency key, a growing wait with jitter, and a maximum number of tries that ends in a state the user can see.

    One line to remember

    “Plan the failure before you write the happy path.”

    Official documentation