Skip to lesson

Mock design round with a checklist

ShopLite just got popular, and the interviewer says: "Design it for 100 times more users. You have 45 minutes." Many people freeze or start drawing boxes. A fixed order of steps keeps you calm and on time.

Your turn: the first five minutes

The interviewer says: "ShopLite now has 5 million users, and a flash sale opens at 6 pm. Design the sale page and checkout." Before reading on, think for one minute and write your answers down.

  • Which three questions would you ask before drawing anything?
  • Which one number would change your design the most?
  • With only 45 minutes, which part would you spend the most time on?

Keep your answers. The next sections show one good order of steps, and you can compare it with yours.

One good design: the eight steps

Design-round checklist is the same eight steps for every question: requirements, estimates, API, data model, architecture, deep dive, bottlenecks and wrap-up.

Each step produces something you can point at, so you always know what to do next. Here are the eight steps and what each one produces.

Text
1 Requirements    functional + non-functional, with numbers; ask, then write them down2 Estimates       users -> requests/s (avg, peak), storage, read/write ratio3 API             the 2-4 main calls: method, path, request, response, status4 Data model      main tables or stores, keys, the one index that matters5 Architecture    diagram in words: client -> LB -> services -> cache/DB/queue6 Deep dive       the hardest part in detail (the interviewer may pick it)7 Bottlenecks     what breaks first, single points of failure, fixes8 Wrap-up         trade-offs: "chose X, gave up Y, because Z"; what next

The list is the six-step framework from the first module, with bottlenecks and wrap-up written out as their own steps so you never skip them.

Say the step name aloud as you start it ("Now the data model"). The interviewer can follow you, and you notice when one step takes too long.

Worked mock round: an online ticket waiting queue

Virtual waiting room is a queue that holds users in line when far more arrive than a system can serve, and lets a fixed number per minute into the booking page.

Follow the mock round below minute by minute, then run the Java simulation of its core.

Example 1 · The mock round, minute by minute

Text
Interviewer: Design an online waiting queue for ticket sales, like a big concert.Candidate (requirements, 0-5): Users join a queue when sales open, see their position  and wait; we let a fixed number in per minute to book; each admitted user gets  10 minutes to book. Fair order (first come, first served). How many users?Interviewer: About 2 million in the first minute. The booking system handles 500 users/s.Candidate (estimates, 5-9): 2M / 500 per s = 4,000 s, about 67 minutes to clear.  Joins peak near 2M in 60 s = ~33,000 joins/s, so joining must be very cheap.Candidate (API, 9-13): POST /api/v1/queue/{eventId}/join -> 202 {ticketId, position}  GET /api/v1/queue/{eventId}/status?ticketId=... -> {position, etaSeconds, admitToken?}Candidate (data, 13-17): Queue = sorted set in Redis: ticketId -> join sequence number.  Admit token = signed JWT {userId, eventId, exp = now + 10 min}.Candidate (architecture, 17-25):  [Browser] --join/poll every 10 s--> [CDN + LB] --> [Queue API x N, stateless]  [Queue API] --> [(Redis: queue + counters)]  [Admitter job, every second] --pop 500--> issue tokens  [Browser + token] --> [Booking service] --> [(MySQL seats)]Interviewer: What if 2 million browsers poll every 10 seconds?Candidate (deep dive, 25-35): That is 200,000 status reads/s. I return a "check again  after N seconds" hint that grows with position, so far-back users poll every 60 s;  and status is a cheap Redis rank lookup. Seats are booked with a row lock so two  admitted users cannot take the same seat.Candidate (bottlenecks, 35-41): Redis is a single point of failure -> replica with  failover; the admitter job runs as one leader with a standby.Candidate (wrap-up, 41-45): Chose a fair FIFO queue and token admission; gave up  instant booking for everyone, because the booking system can only take 500/s.
Round summary
Steps covered: all 8
Key number: 2M users / 500 per s = about 67 minutes
Interviewer push: polling load, answered in the deep dive

What this code does

  • Every step starts with its minute range, so you can see the 45-minute plan working.
  • The estimate both justifies the queue and shows the hard part: 33,000 joins per second and 200,000 status polls per second.
  • The wrap-up uses the trade-off sentence: chose a fair queue, gave up instant booking, because of the 500 per second limit.

Example 2 · Simulating the waiting room

WaitingQueueDemo.javaJava
import java.util.ArrayDeque;import java.util.ArrayList;import java.util.Deque;import java.util.HashMap;import java.util.List;import java.util.Map;
class WaitingRoom {    private final Deque<String> queue = new ArrayDeque<>();    private final Map<String, Integer> tokens = new HashMap<>();    private final int admitPerTick;    private final int bookingWindowTicks;
    WaitingRoom(int admitPerTick, int bookingWindowTicks) {        this.admitPerTick = admitPerTick;        this.bookingWindowTicks = bookingWindowTicks;    }
    String join(String user) {        queue.addLast(user); // first come, first served        int position = queue.size();        int waitTicks = (position + admitPerTick - 1) / admitPerTick;        return user + " joined: position " + position + ", about " + waitTicks + " min";    }
    List<String> admit(int now) {        List<String> admitted = new ArrayList<>();        for (int i = 0; i < admitPerTick && !queue.isEmpty(); i++) {            String user = queue.pollFirst();            tokens.put(user, now + bookingWindowTicks); // a signed token in a real system            admitted.add(user);        }        return admitted;    }
    String book(String user, int now) {        Integer expiresAt = tokens.get(user);        if (expiresAt == null) {            return user + ": 403 not admitted yet";        }        if (now > expiresAt) {            return user + ": 403 booking window expired";        }        tokens.remove(user);        return user + ": 201 seat booked";    }
    int waiting() {        return queue.size();    }}
public class WaitingQueueDemo {    public static void main(String[] args) {        WaitingRoom room = new WaitingRoom(2, 1); // admit 2 users a minute, 1 minute to book        for (String u : new String[] {"asha", "bilal", "chen", "divya", "esha"}) {            System.out.println(room.join(u));        }        System.out.println(room.book("chen", 0));        for (int minute = 1; minute <= 3; minute++) {            System.out.println("minute " + minute + ": admitted " + room.admit(minute) + ", still waiting " + room.waiting());        }        System.out.println(room.book("asha", 1));        System.out.println(room.book("bilal", 3));        System.out.println(room.book("chen", 2));    }}
Output
asha joined: position 1, about 1 min
bilal joined: position 2, about 1 min
chen joined: position 3, about 2 min
divya joined: position 4, about 2 min
esha joined: position 5, about 3 min
chen: 403 not admitted yet
minute 1: admitted [asha, bilal], still waiting 3
minute 2: admitted [chen, divya], still waiting 1
minute 3: admitted [esha], still waiting 0
asha: 201 seat booked
bilal: 403 booking window expired
chen: 201 seat booked

What this code does

  • join adds the user at the back and estimates the wait as position ÷ admissions per minute, rounded up.
  • admit lets 2 users in per minute and gives each a token with an expiry; in the real design it is a signed JWT with a 10-minute window (here 1 minute to keep the run short).
  • book refuses users who were not admitted (chen at minute 0) or whose window passed (bilal at minute 3).

The estimate drives everything: 2 million users at 500 per second take 4,000 seconds to clear, so the queue must exist. ShopLite's flash sale has the same shape.

The program joins users first come, first served, admits a fixed number per minute, and expires each booking window.

Handling hints and changing requirements

Hint is an interviewer question that points at something you missed, such as "What if a bot joins 10,000 times?". Treat it as help, not as an attack.

A changing requirement is a new rule added mid-round, such as "premium members go first". Restate it, say what changes and what stays, and name the new trade-off.

Example 3 · A changing requirement and a hint

Text
Interviewer: New requirement: premium members must get in before normal users.Candidate:  1. Restate it: "So premium users skip ahead, but order inside each group stays FIFO?"  2. Say what changes: one queue becomes two (premium, normal); the admitter takes     from premium first, for example up to 400 of every 500 admissions.  3. Say what stays: join API, tokens, booking service and Redis stay the same.  4. Name the trade-off: normal users wait longer; I would cap the premium share     so normal users still move every minute.Interviewer (hint): What if a bot joins 10,000 times?Candidate: Thank you, I missed that. Join needs a logged-in user and one ticket per  user per event, plus a rate limit per account and per IP on the join endpoint.
What happened
Changed: one queue -> two queues, admitter picks premium first
Unchanged: join API, tokens, booking service
Hint accepted: login + one ticket per user + rate limit

What this code does

  • The candidate restates the new rule before changing anything, which avoids solving the wrong problem.
  • The hint about bots is accepted with thanks and fixed with tools from earlier modules: auth and rate limits.

Both tests check whether your design is clear enough that you can change one part without breaking the rest. Never restart the design.

Put the four moves for a changed requirement in order.

Order of execution

Handle a changed requirement

The interviewer adds "premium users go first". Put your four moves in order.

A self-scoring rubric for a design answer

Rubric is a list of what a good answer contains, with points for each item. Interviewers use something similar, even when they do not show it.

After each practice round, score yourself on eight items that match the checklist. The program below adds up the points and prints what you missed.

Example 4 · Scoring a practice round

RubricScoreDemo.javaJava
import java.util.LinkedHashMap;import java.util.Map;
record Criterion(int weight, boolean met) {}
public class RubricScoreDemo {    public static void main(String[] args) {        Map<String, Criterion> rubric = new LinkedHashMap<>();        rubric.put("Asked clarifying questions, wrote requirements", new Criterion(15, true));        rubric.put("Estimates with stated assumptions", new Criterion(10, true));        rubric.put("Clear API and data model", new Criterion(15, true));        rubric.put("Diagram matches the request flow", new Criterion(15, true));        rubric.put("Deep dive on the hardest part", new Criterion(15, false));        rubric.put("Found bottlenecks and single points of failure", new Criterion(15, true));        rubric.put("Trade-offs as 'chose X, gave up Y, because Z'", new Criterion(10, false));        rubric.put("Finished on time with a summary", new Criterion(5, true));
        int score = 0;        int total = 0;        for (Map.Entry<String, Criterion> e : rubric.entrySet()) {            Criterion c = e.getValue();            total += c.weight();            if (c.met()) {                score += c.weight();            } else {                System.out.println("Missed (" + c.weight() + "): " + e.getKey());            }        }        String band = score >= 85 ? "strong" : score >= 65 ? "good, fix the misses" : "practise the checklist again";        System.out.println("Score: " + score + "/" + total + " -> " + band);    }}
Output
Missed (15): Deep dive on the hardest part
Missed (10): Trade-offs as 'chose X, gave up Y, because Z'
Score: 75/100 -> good, fix the misses

What this code does

  • Weights add up to 100, and each item matches a checklist step.
  • The program prints only the misses, which are the two things to practise next: the deep dive and trade-off sentences.

The items you miss most often are what to practise next, which is more useful than another random question.

Common slip: scoring yourself on how much you said. Score only what the rubric asks for.

Time checkpoints across a 45-minute round

Time checkpoint is a minute by which a step should be done. In a 45-minute round: data model by minute 17, deep dive by minute 35.

Split the 45 minutes into fixed steps. The program below prints each step with its start and end minute.

The 45-minute design round as eight bars on a timeline: requirements 0 to 5, estimates 5 to 9, API 9 to 13, data model 13 to 17, architecture 17 to 25, deep dive 25 to 35, bottlenecks 35 to 41, wrap-up 41 to 45. Two dashed lines mark minute 17 and minute 35.

Example 5 · Printing the 45-minute plan

RoundTimerDemo.javaJava
import java.util.LinkedHashMap;import java.util.Map;
public class RoundTimerDemo {    public static void main(String[] args) {        Map<String, Integer> minutes = new LinkedHashMap<>();        minutes.put("Requirements", 5);        minutes.put("Estimates", 4);        minutes.put("API", 4);        minutes.put("Data model", 4);        minutes.put("Architecture", 8);        minutes.put("Deep dive", 10);        minutes.put("Bottlenecks", 6);        minutes.put("Wrap-up", 4);
        int clock = 0;        for (Map.Entry<String, Integer> step : minutes.entrySet()) {            int end = clock + step.getValue();            System.out.printf("%02d-%02d  %s%n", clock, end, step.getKey());            clock = end;        }        System.out.println("Total: " + clock + " minutes");        System.out.println("Checkpoint: by minute 17 the API and data model are on the board");    }}
Output
00-05  Requirements
05-09  Estimates
09-13  API
13-17  Data model
17-25  Architecture
25-35  Deep dive
35-41  Bottlenecks
41-45  Wrap-up
Total: 45 minutes
Checkpoint: by minute 17 the API and data model are on the board

What this code does

  • A LinkedHashMap keeps the steps in order; the running clock turns durations into checkpoints.
  • Minute 17 is the key checkpoint: by then the API and data model should be on the board.

The deep dive gets the most time, because that is where the interviewer learns how deeply you think. If you reach minute 17 without a data model, cut detail and move on; an unfinished design scores worse than a simple complete one.

Now predict what the clock says.

Predict the output

Where is the clock?

Read the code and pick what it prints.

Round 1 of 2

Requirements, estimates, API and data model take 5, 4, 4 and 4 minutes. What is printed?

int[] minutes = {5, 4, 4, 4};
int clock = 0;
for (int m : minutes) {
clock += m;
}
System.out.println("Data model done by minute " + clock);

Next step

Check your understanding

12 quick questions