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

Module 03 · Networking · Faster, private, everywhere · about 14 min to read

Play it as a journeyTutor comes with a plan

Many doors, one address: load balancers and proxies

One Address A Thousand Doors
One Address A Thousand Doors · Open board

One address answered from many buildings. This lesson goes inside one building and shows what stands behind that address.

A small online shop runs on three servers, called A, B and C. Customers see one address. At 11 pm the team deploys a new version, one server at a time. Server A is restarted while customers are paying. Two of the payments on A fail halfway. Later that week server B crashes at noon, and for about a minute one customer in three sees an error page, although A and C are fine the whole time.

Nothing is wrong with the servers. The thing in front of them is doing a job nobody told it about. By the end of this lesson you will be able to say what a load balancer can and cannot see, how it learns that a server is dead, and how to take a server out without breaking a single payment.

Before you start. One address, a thousand doors showed that one address can be answered from many buildings, and that ordinary routing sends each visitor to the nearest one. TCP vs UDP, and the 3-way handshake gave you the connection: a promise that bytes arrive in order, which costs one round trip to open. What a request actually says (HTTP) gave you the request: a first line with a method and a path, then headers. Everything here sits between those three.

The history (optional)

Google’s own network load balancer is called Maglev. Its paper, “Maglev: A Fast and Reliable Software Network Load Balancer” by Danielle Eisenbud and colleagues, appeared at the NSDI conference in Santa Clara in 2016. The abstract says Maglev has served Google’s traffic since 2008. It also says the routers spread packets across Maglev machines using a method called equal-cost multipath, and that each Maglev machine then spreads packets across the servers behind it. That two-step shape, many balancers in front of many servers, is the one this lesson ends on.

Lesson 32 of 44 in Networking

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The reverse proxy: one program that takes the visit for the servers
  • Layer 4 and layer 7: what the load balancer is able to read
  • The health check: asking each server whether it is alive
  • Connection draining: removing a server without cutting anyone off
  • Anycast recap, then the second layer
  • The core of the layer 4 and layer 7 programs
  • Draining and ejection in code
  • Edge cases and trade-offs

Terms it explains: reverse proxy, load balancer, layer 4, layer 7, health check, Connection draining.

Lab

Move the split one bit and the street halves. How many machines fit, and how do they share one public address?

Drag How many doors this street has one notch, watch What fits, then press Next device to admit each one.

Open One address, many doors

Related paper

Review Networking