Skip to main content

Checkpoint: Load Balancing & Traffic

Introduction

Eight lessons ago, the front door was one sentence: put a box in front and spread the traffic. Look at what it is now. You can make that box fast and blind (L4) or smart and reading (L7). You can make it spread by count, live load, two random peeks, or a hash. You can let it pin a user to one server — and you know exactly what that pin costs. It keeps a health roster and routes only to the living; it can say no, politely, at 429-speed; and one level up, GeoDNS and anycast play the same game with continents instead of servers.

That's a lot of machinery — and here's the thing this checkpoint exists to prove: none of it is a feature list to memorize. It's a decision kit. Layer, algorithm, stickiness, health checks, global routing, rate limiting: six dials, and the right setting for every one of them depends on the business standing behind the door. The same six questions produce completely different front doors for a bank, a game, and a flash sale.

So no new ideas today. Instead: three real businesses, eighteen decisions, and you in the architect's chair. If §5 stuck, you won't be remembering answers — you'll be deriving them.

A single map of everything the load-balancing section built, drawn as one request's journey through the complete front door. A user on the left first meets the global layer, where GeoDNS or anycast routes them to the nearest healthy region on a small world-map strip. Inside the region the request reaches the load balancer, annotated with the decisions the section taught: which layer it works at, L4 fast and blind or L7 reading paths, hosts and cookies; which algorithm spreads the load, round-robin, least-connections, power-of-two or hash; and whether sticky sessions pin a user to one box. In front of the pool a rate limiter turns a flood into fast 429s, and the pool itself is a health-checked roster where probes mark each server in or out of rotation, with traffic flowing only to the green boxes and around the ejected red one. Three scenario cards at the bottom preview the checkpoint's challenge: a fintech public API with EU data-residency rules, a real-time multiplayer game on UDP, and a legacy shop with carts in server memory facing a flash sale — three very different businesses whose correct front doors reuse the same six decisions with different answers. The takeaway is that the section's lessons are not features to memorize but a decision kit: layer, algorithm, stickiness, health checks, global routing, and rate limiting, chosen per situation.

See It: Front-Door Architect

Three scenarios, each a business you've effectively met across this section: a fintech public API (bursty browser clients, microservice paths, EU data-residency law), a real-time multiplayer game (UDP, players worldwide, a dead region mid-match is a catastrophe), and a legacy shop with carts in server memory, one week from a flash sale it cannot re-architect for.

For each one, set all six dials — layer, algorithm, sticky, health check, global, rate limiter — and watch the topology you're designing draw itself live, requests flowing through it. Then check your setup: every slot comes back green or red with the reason, and the reasons are the section's sharpest edges. Watch especially for the traps you've been warned about: the deep health check that looks diligent and ejects a fleet, the sticky session that's a legitimate bridge in exactly one of these scenarios, the latency-routing choice that quietly breaks the law, and the scenario where the honest global-routing answer is don't.

Eighteen decisions. Same six questions every time — and three very different correct doors.

Front-Door Architect — three real businesses, six front-door decisions each, and you are the architect. For each scenario — a fintech public API with EU data-residency rules, a real-time multiplayer game on UDP with players worldwide, and a legacy e-commerce app with carts in server memory heading into a flash sale — pick the layer (L4 or L7), the balancing algorithm, sticky sessions on or off, the health-check depth, the global routing mechanism, and the rate-limiting algorithm. A live topology drawing updates with every choice and animated requests flow through the front door you designed. Check your setup and every slot is graded with the why — including the traps this section warned about: the deep health check that ejects a whole fleet, the sticky session that is right as a bridge and wrong as a habit, latency routing that violates data residency, and global routing on top of single-region data. Eighteen decisions in all; the same six questions, three very different right answers.

What You Can Now Do

Crossing this checkpoint means the front door is yours. Concretely, you can now:

  • Choose a layer on purpose — L7 as the default for anything HTTP (paths, cookies, TLS, WAF), L4 when the protocol isn't HTTP or microseconds matter, and both stacked when you want speed outside and brains inside.
  • Match the algorithm to the unevenness — round-robin when requests and servers are uniform, least-connections or power-of-two when they aren't, hashing only when the same client must land on the same box.
  • Use stickiness like a professional — which mostly means not using it, and recognizing the one honest case: a bridge for state you can't externalize yet, with an exit plan.
  • Keep a health check from becoming the outage — shallow probes, thresholds with hysteresis, and the reflex to ask "what happens to this check when the database blips?"
  • Route the planet — geolocation when law demands determinism, latency when speed is the goal, anycast when failover must be measured in seconds, and layers of both in real systems.
  • Say no cheaply — a token bucket for bursty humans, a leaky bucket for fragile machines, and a 429 with Retry-After instead of a fleet-wide meltdown.
  • Name the boundary — everything above arranges capacity. When the pool is genuinely full or genuinely gone, the front door's job is over, and the answer lives behind it.

Key Takeaways

The section in six lines — the ones worth keeping forever:

  • A load balancer's power is bounded by what it can see (the layer), and its wisdom by what it measures (the algorithm). Blind-and-fast or reading-and-smart is a choice, not a ranking.
  • Bursts are the whole game. Algorithms differ at the edges: uneven requests break round-robin, boundary bursts break fixed windows, and every limiter is an answer to "what happens to a burst?"
  • Health checking makes a system self-ejecting, not self-healing. Shallow checks, thresholds, panic mode, and retry budgets are what keep self-ejecting from becoming self-destructing.
  • Sticky sessions hide statefulness; they don't remove it. Bridge, not destination.
  • Global load balancing is the same roster idea at continent scale — and it only removes the single-region SPOF if the data went multi-region too.
  • Routing never creates capacity. The most beautifully balanced, health-checked, rate-limited front door in the world still opens onto whatever you actually built behind it.

And that's exactly where the course goes next: through the door. The servers are healthy, the traffic is spread — now, what do those servers actually say to the world? Contracts, verbs, versions, and the art of an interface that survives its own success: §6, APIs.