A System Design Interview, Worked End to End: The Order-Tracking Page of a Food-Delivery App in Seven Steps
Design the order-tracking page of a food-delivery app in 45 minutes. One million orders a day becomes about 35 new orders a second at peak, 84,000 in flight, 42,000 open pages, 8,400 position reads and 16,800 rider writes a second. Status goes to a database with a replica, positions to memory, and every failure gets a planned answer.
What you will learn
- Answer a design question in seven steps: clarify, numbers, API and data, diagram, hot path, failure modes, trade-offs
- Turn stated assumptions into peak reads, writes and storage with simple arithmetic
- Give fast, disposable data and slow, precious data different homes
- Name failure modes and trade-offs out loud, the way an interviewer wants to hear them
Before you start
- Caching and read replicas
- Rate limiting basics
The interviewer leans back and says: design the order-tracking page of a food-delivery app. You have 45 minutes and a blank whiteboard. Most people freeze, or start drawing a database in the first ten seconds. A good answer starts with questions instead. This article walks through one answer from start to finish with a seven-step checklist, the way a pilot reads a pre-flight list on every flight. The list is there because under pressure people forget things, and an interview is pressure.
Step 1: Clarify
Ask what the page must do. It shows the order status (placed, cooking, on the way, delivered), shows the rider on a map, and sends a push message when the food is arriving.
Then say what is out of scope: payments, the menu and the restaurant's screens. Saying it aloud gets the interviewer to agree, and you stop spending minutes on parts nobody asked for.
Then the qualities. The position should be fresh within five to ten seconds. Many people read the page at once. And the status must never go backwards: nobody wants to see "delivered" followed by "cooking". Two minutes of questions and the problem is already smaller.
Step 2: Numbers
State the assumptions out loud: one million orders a day, each tracked for about 40 minutes, the app refreshing the rider position every five seconds while the page is open, half of customers keeping the page open, and a busy hour three times the average. Then do the arithmetic slowly:
| Quantity | Working | Result |
|---|---|---|
| Average new orders | 1,000,000 / 86,400 s | about 11.6 a second |
| Peak new orders | 11.6 × 3 | about 35 a second |
| Orders in flight | 35 × 2,400 s (40 minutes) | about 84,000 |
| Open pages | 84,000 / 2 | about 42,000 |
| Position reads at peak | 42,000 / 5 s | about 8,400 a second |
| Rider position writes | 84,000 riders / 5 s | about 16,800 a second |
| Status rows stored | about 5 changes × 1,000,000 | 5,000,000 a day |
The surprise is that writes outnumber reads, because every rider reports every five seconds even when nobody is watching. The stored status data is small. Rider pings go stale quickly, so only the latest one is kept, in memory, instead of every ping in the main database.
Step 3: API and data
GET /orders/{id}/status: the customer app asks what the order is doing.POST /riders/{id}/position: the rider's phone sends where it is, every five seconds.- Optionally, a push stream where the server sends updates without being asked. That gets compared with polling in step 5.
Two data shapes. A status history table with order id, status and time, one new row each time the status changes. And the latest position per rider: one key per rider whose value is the newest coordinates, overwritten every time, with no history. The two kinds of data have different lives: slow, precious status and fast, disposable position.
Step 4: The diagram
Only now do you draw boxes.
The customer app hits a load balancer, which spreads requests over several copies of the tracking service, so one copy can fail and the others carry on. Status lives in a database with a primary for writes and a replica for reads. Positions live in an in-memory key-value store. The rider app sends pings to a small ingest service that writes to the position store.
Step 5: The hot path
Position reads, about 8,400 a second, never touch the database. They are answered from memory. Status is read a lot but changes only about five times per order, so cache it and clear the cache entry when the status changes. Readers then always get a fresh value. (The mechanics of that are in caching with Spring and Redis.)
How does the phone get updates?
| Polling every 5 s | Push stream (WebSockets or server-sent events) | |
|---|---|---|
| For | Simple, works on any network | Sends only changes |
| Against | Most answers are the same as last time | 42,000 open connections to look after |
For a first version I would poll and say that push is the next step. Saying that out loud is worth more than the choice itself.
Step 6: Failure modes
| What breaks | What the user sees |
|---|---|
| The position store goes down | The last known position, with a small "updating" note. The page does not break. |
| The rider's phone goes offline in a tunnel | The position is marked stale, showing how old it is. |
| The database primary dies | A standby takes over. Status may pause for a few seconds, and nothing is lost. |
| A buggy app refreshes every second | A per-user rate limit, so one customer cannot hurt 42,000 others. |
Interviewers like this step because most candidates skip it. The rate limit and the fallback answers are built in Java in rate limiting and load shedding and Resilience4j.
Step 7: Trade-offs
- Positions only in memory: fast, and if the store crashes a few seconds of positions are lost. For a dot on a map that is fine.
- Position may lag, status must be right. The dot can be five seconds behind. Status must never go backwards, so that is where the care goes.
- Polling is simple and push is efficient. Simple went first.
A named trade-off shows the interviewer you understood the choice, so don't treat it as a weakness.
What the interviewer hears
They listen for thinking out loud, numbers before boxes, named trade-offs, and what you would measure, such as how old the position is and the error rate. The common mistakes are jumping to microservices in minute one, giving no numbers, and ignoring failure as if nothing ever breaks. None of that depends on a clever technology. A general way to structure any single answer is in the five-move interview answer.
The whole answer
- Clarified: status, map, arrival push; payments and menus out; fresh in 5 to 10 seconds, status never backwards.
- Counted: 35 orders a second at peak, 8,400 reads and 16,800 writes a second, 5,000,000 rows a day.
- API and data: two endpoints, a status history table, a latest-position key per rider.
- Diagram: load balancer, tracking service copies, database with replica, position store, ingest.
- Hot path: positions from memory, status cached and cleared on change, polling first.
- Failures: a planned answer for each.
- Trade-offs: said out loud.
Seven ticks on a whiteboard, in order, and you will not freeze. It works for food delivery and for most other design questions.
StudyEasy AI Community
Learn AI engineering, share what you build, and connect with other learners.
Free resources: lesson files, notebooks and code
Ask questions and join engineering discussions
Meet real people learning and building with AI
Related course on Udemy
FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE
Java 25, JSP, Hibernate, Spring Boot 4, REST APIs, React and Spring AI.View on Udemy ↗: FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE (paid course, opens in a new tab)Related posts
Fallback Models for an LLM App: A Chain That Checks Region and Fit, Flags Degraded Answers and Gets Rehearsed
When the main model goes down, the backup has to be allowed to take the data, able to read the whole request and tested before the bad day. A simulated four-model chain for an EU customer: a 6,000-token request lands on mid-eu, flagged degraded; a 10,000-token request is served by nobody, on purpose.
Back Pressure for LLM Traffic: Bound the Queue, Give Chat Its Own Lane, Count Tokens, Cancel When the Caller Leaves
A bulk upload buries the chat. In a small simulation, one shared queue grows to 199 waiting and the middle chat answer takes 80.2 s. A bound plus a chat lane brings it to 0.35 s while 178 bulk jobs are told to retry in 10 s, and cancelling abandoned calls saves 21,000 wasted tokens.
Load Balancing LLM Traffic: Count the Work, Weigh the Prefix Cache, Check Real Health, Drain Before Deploys
Six GPU replicas, two at 95% and four at 30%: round robin counts requests, and requests aren't equal. In a small simulation, least outstanding requests cuts p95 from 6.52 s to 3.05 s, prefix affinity lifts cache hits to 95% but pushes p95 to 11.45 s, a real health check takes errors from 48 to 2, and draining cuts 0 answers instead of 4.
A Message Queue for Document Ingestion: At Least Once, Leases, an Idempotent Consumer and a Dead Letter Queue
A queue doesn't lose a document, but it can hand one out twice. In a small simulation, a worker crash makes document two go from 3 to 6 chunks and the index holds 11 when the documents hold 8. An idempotent consumer brings it back to 8 with the same two deliveries, and a limit of three tries moves a poison file to a dead letter queue.
