Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

System Design the lesson

The order slip rail a show in 8 chapters

Goal: let the counter take every order without waiting, and keep the wait short

1 of 8 Your guess

Before we start

The chai stall is famous now. One person takes orders at the counter, another works the stove, and the stove is far slower than the counter.

Which picture is closest to how a busy website handles work it cannot finish right away?

Pick the closest. You find out which fits at the end.

2 wires123456789101112mincalls so far16busy tones0

16 calls ÷ 12 minutes = 1.33 a minute. Part of a wire cannot be bought, so 2.spaced out, no minute has more than 2 calls: 0 busy tones

2 of 8 The problem

1909: how many wires to buy

In 1908 a Danish engineer, Agner Krarup Erlang, joined the Copenhagen Telephone Company and was handed a question no opinion could settle. Every call needed a wire of its own across town. How many wires should the company buy?

The obvious answer is to count the calls and buy enough for the average. Here is a made-up afternoon: 16 calls in 12 minutes, each a minute long, spaced out evenly.

Step 1 of 2

The counter has stopped11 waiting3 cups?waits2 ordersbehind

3 of 8 The problem

Back at the stall: the counter freezes

A customer asks for three cups. The order-taker calls it through, then stands there: the cook is 2 orders behind and there is nowhere to put the new one.

Behind that customer 11 people wait, none of them served. Nobody is cooking slower. The counter has simply stopped.

Your goal: let the counter take every order without waiting on the stove, and keep the wait short.

Step 1 of 2

tokens handed out0on the wire0waiting: 12

4 of 8 The fix

The wire over the stove

Every busy stall in India owns the fix, for forty rupees: a wire strung above the stove. The order-taker writes each order on a paper slip, clips it to the wire, hands over a numbered token and says next.

The cook pulls slips off at whatever pace the stove allows. Here comes the rush of 12.

Press Play: 12 customers, one wire.

Step 1 of 2

50 orders in, 40 cups out, every hour101202303404505606707808hourslips on the wire, end of each hour

50 in − 40 out = 10 more slips every hourafter 8 hours: 8 × 10 = 80 slips

5 of 8 The cost

Erlang's bad news: busy is not spare

It feels like the wire bought capacity. It did not. The wire holds slips, it does not cook.

Orders arrive for 50 cups an hour and the stove makes 40. The wire grows all day, and every token is a longer lie.

A queue smooths bursts. It cannot fix a stove slower than the day.

Step 1 of 3

slip 41 came off the wireand burned: no tea, no record424341?

6 of 8 The fix

The dropped slip

Now break something. The cook pulls slip 41, turns to the stove and drops it in the fire.

If taking a slip removed it from the wire, that order no longer exists anywhere. A customer is outside holding a token for tea nobody is making.

That failure is the worst kind: silent.

Step 1 of 2

7 of 8 Your guess

Your picture now

The wire took the rush of 12 in 48 s (chapter 4). At 80% busy the stove adds 4 cooking times of wait, at 95% it adds 19 (chapter 5). A burned slip comes back (chapter 6). Which picture is closest now?

Pick one.

The order slip railWrite the work down in the middle, so the fast end never waits on the slow end.414243444546a slip for each order, a token for each customer48 sa rush of 12 taken (12 × 4 s), not 18 minutesBusy is not spare. The extra wait,in cooking times, is busy ÷ idle:19cooking times of wait at 95% busy: 0.95 ÷ 0.05Idle time is the shock absorber: a gap is where a bunch drains away.The price: at-least-once. A slip can be cooked twice, so twice must be safe.chalkbrain.com
The order slip railWrite the work down in the middle, sothe fast end never waits on the slow end.41424344454648 sa rush of 12 taken (12 × 4 s),not 18 minutes19cooking times of wait at 95% busy:busy ÷ idle = 0.95 ÷ 0.05Idle time is the shock absorber.The price: at-least-once. A slip can becooked twice, so twice must be safe.chalkbrain.com

8 of 8 Keep this

Keep this

Write the work down in the middle and hand a token for it, so the fast end never waits on the slow end. Then keep the stove below flat out: the extra wait is busy ÷ idle, so the last few points of busy cost the most.

The price: at-least-once. A slip can come back and be cooked twice, so cooking it twice must be safe.

Read the full lesson