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 chai stall that got famous a show in 8 chapters

Goal: send 300 people an hour to open stalls, with a short wait even for the unluckiest

1 of 8 Your guess

Before we start

A website gets famous overnight. Thousands of people ask for its pages at once, far more than one machine can answer.

Which picture is closest to how a busy website serves them all?

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

1 stove40 cupsan hourbefore the post30 people an hour:nobody waits longwaiting0= 5 people

2 of 8 The problem

The stall gets famous

A chai stall on a corner. One stove, one wala, 40 cups an hour, and that is plenty, because 30 people come.

Then someone posts about it. Now 300 people come every hour. The cups still come out at 40 an hour.

Press Play to watch one hour, a quarter at a time.

Step 1 of 3

Share of traffic on the mainUS long-distance linksMarch 1994under 3%a year laternearly 20%more than anything else on those links

3 of 8 The idea

1994: hand out the doors

This really happened, and the stall was a website.

At the University of Illinois, the NCSA had written Mosaic, the browser that turned the web into something ordinary people used. It pointed at NCSA's own pages. Then the web took off, and NCSA's one machine was the stall on the corner.

Step 1 of 4

the liststall 1stall 2 ←stall 3next: stall 2stall 260 cupshalf donealready waitingstall 3nobody hereThe list cannot see either stall.

4 of 8 The problem

1995: the list is blind

In April 1995, Thomas Brisco wrote the first problem down in the public memos the internet is designed in: the rotating answer put the addresses in an order, but how busy the machines were never came into it.

The phone book is not standing at the stalls. It cannot see that stall 2 is halfway through sixty cups for an office while stall 3 is idle.

Step 1 of 2

the manat the gate12345empty: go here678He can see the lines. The list never could.

5 of 8 The fix

Late 1995: the man at the gate

Netscape's site was one of the busiest on the web, running the rotating list. Its webmaster, Robert Andrews, told John Mayes some machines were very busy and others did almost nothing. He guessed ten customers in the world had this problem.

Mayes drew a box: everything passes through the middle. It shipped in April 1996 as Cisco's LocalDirector. The ten customers turned out to be everybody.

That box is a load balancer: at the stall, a man at the gate with a book of tokens.

Step 1 of 4

the gateevery 2 seconds:"are you up?"1yes2yes3yes4yes5yes6yes7yes8yes

6 of 8 Try it

Are you up?

Here is what the man at the gate can do that a phone book cannot. He asks. Every 2 seconds he puts a question to each stall that only a working stall can answer.

All eight answer. Now kill stall 3.

Step 1 of 3

7 of 8 Your guess

Your picture now

Goal met: 8 stalls that keep nothing, a gate that counts the lines (2.8 s for the slowest 1 in 100, not 7.4 s), and asks every 2 seconds (15 customers lost to a dead stall, not 55). Which picture is closest now?

Pick one.

Load balancingMany stalls that remember nothing, and a man at the gate who looks.123More stalls, not a biggerstove. Stalls keep nothing:every tab is in the register.8 stalls300 an hour ÷ 40 cups, rounded upCount the lines, send eachcustomer to the shortest.2.8 sslowest 1 in 100, not 7.4 sEvery 2 seconds ask eachstall: are you up?15sent to a dead stall, not 55from the lab's 1,600 customerschalkbrain.com
Load balancingMany stalls that remember nothing,and a man at the gate who looks.1More stalls, not a bigger stove.Every tab in the register.8 stalls300 an hour ÷ 40 cups, rounded up2Count the lines, send eachcustomer to the shortest.2.8 sslowest 1 in 100, not 7.4 s3Every 2 seconds ask eachstall: are you up?15sent to a dead stall, not 55chalkbrain.com

8 of 8 Keep this

Keep this

Grow by adding stalls, not a bigger stove. Keep every tab in the register so any stall will do. Put a man at the gate who counts the lines and asks each stall whether it is up.

The price: the gate is now one thing that can die, and the register is now the busiest thing in the shop.

Read the full lesson

Move the dial yourself in the load balancer lab