System design round

Design Live Delivery Tracking

Live tracking is a write-heavy system that people experience as a read: hundreds of thousands of phones report where they are every few seconds, and each update matters to exactly one customer.

Estimate, draw your design, run its traffic through it and see which boxes break. Then answer the follow-up questions. The load test is free and needs no account; an AI review or score uses one of your AI replies.

The brief

It must

  • Delivery partners’ apps report their location every few seconds.
  • A customer sees their partner move on the map, live.
  • Customers open their order page to see its status.
  • Keep a history of routes for disputes and better ETAs, without slowing anything down.

The numbers

  • Assume 500,000 delivery partners online at dinner time, each sending a location every 4 seconds.
  • Assume 1 million customers watching an order on the map, each shown an update every 4 seconds.
  • Customers open order pages about 20,000 times a second.

Before you draw: the numbers

Interviewers expect a quick estimate first, because the numbers decide the design. Write yours, then check.

The load test uses round numbers per box, the kind you would use on a whiteboard, so it shows where a design breaks and roughly by how much, not exact figures. How it works

The follow-up questions

Once your design is up, the interviewer goes deeper. Each question changes one thing and is a level further, Fresher to Senior. An AI interviewer scores your answer; 6 out of 10 or more climbs the rung.

Swiggy live tracking

Not climbed yet

Our design, and why

Try your own first. “Our design” on the board shows it as boxes you can load-test.

125,000 writes a second of data that is only interesting for a few seconds. The design keeps the latest location in memory, sends history somewhere cheap in the background, and pushes each update to the one customer who cares.

  • Latest location in Redis: one key per partner, overwritten each time, expiring after 30 seconds so offline partners drop out on their own. Two shards take the writes; a replica each survives a node failure.
  • History through Kafka: workers batch route points into a cheap store. Nobody waits for it, so it never slows an update.
  • WebSocket servers hold the customers’ connections, about 50,000 each, and subscribe to a channel per order. An update is published once and reaches only the server holding that customer.
  • Orders stay in Postgres, untouched by the location traffic.

Reconnects are the hard part of push: every deploy drops connections. Apps reconnect with backoff and jitter, read the latest location once, then resume the stream, and fall back to polling when a connection will not hold.

What each level is expected to cover

The AI review grades your board against these.

Fresher
  • Partners post locations; customers read their partner’s latest location.
  • Access checks: only the customer of an active order.
SDE 1
  • Latest location in Redis with a TTL, not a row per update.
  • History streamed to Kafka and written in batches.
SDE 2
  • Push over WebSockets or SSE, sized by connections.
  • Pub/sub keyed by order; reconnects and a polling fallback.
Senior
  • Finding nearby partners with a geospatial index (geohash, H3, Redis GEO).
  • Atomic claims so two orders cannot take one partner.
  • ETA from road routing, and batching orders.

How the load test works

Each round sends a few kinds of traffic from its users, at the rates in the brief. The test follows your arrows: a CDN answers what it can cache, a load balancer spreads requests, a service runs the logic and checks a cache beside it before the database, and a queue takes work off the request so the boxes after it work at their own pace.

Every box takes a rough number of requests a second (one service machine about 5,000, one Redis node about 100,000, one SQL primary about 3,000 writes, one row about 200 updates). A box asked for more turns red and drops the excess, unless a queue in front holds it back, in which case the queue grows and the work waits. Failure scenarios take machines away; a standby copy covers one.

It cannot see correctness: idempotency, consistency, and what users see when something fails. Write those in a box’s note; the AI review reads them.

blur