ulearn/systems

topics / traffic-routing

Load Balancer

Round robin, least connections, weighted and IP-hash routing across a pool of backends. Break one on purpose and watch the routing decision change.

Every term this topic uses, defined once. Anywhere you see a word with a dotted underline — on Simulate or Study — hovering (or tapping, on touch) shows the same definition inline; this page is just the full list in one place.

Terms

Round robin

Sends each new request to the next backend in a fixed rotation, looping back to the start once it reaches the end. Simple and even when every backend is roughly equal, blind to how loaded each one actually is.

Least connections

Sends each request to whichever backend currently has the fewest active connections. Adapts to backends that are actually running slow, unlike round robin which just counts turns.

Weighted round robin

Round robin where each backend gets a weight, and higher-weight backends receive proportionally more requests — for a bigger box that can genuinely handle more traffic than its neighbors.

IP hash

Hashes the client's IP address to consistently pick the same backend for the same client — useful for sticky sessions, since a client keeps landing on the same server across requests.

URL hash

Hashes the requested path to consistently route the same URL to the same backend — useful when a backend caches per-URL and you want cache hits to stay high.

Sticky session

A client keeps landing on the same backend across multiple requests, instead of being spread across the pool each time — needed when a backend holds per-client state in memory.

Health check

How a load balancer detects a backend has actually gone bad — here, modeled as repeated failed requests. After enough consecutive failures, the backend is automatically marked down and stops receiving new traffic.

Mark down (auto)

A backend getting pulled out of rotation automatically, after failing its health check too many times in a row — distinct from a human manually taking it offline.

Rejected

A request that couldn't be routed anywhere at all, because every backend is currently unhealthy. A load balancer can spread traffic across healthy backends — it can't invent capacity none of them have.

DDoS

Distributed Denial of Service — a flood of requests from many sources at once, aimed at overwhelming a system's capacity rather than exploiting a specific bug.