Load Balancer 00:00:01 Three checkout workers share one address A shopper sees a single hostname while the deployment contains three checkout workers. Design a proxy that turns one client-facing address into a reliable choice among backends, then returns the correct response. DNS answers shop.example with one address. The client remembers it. The index points at server A. It moves to B for the next request. A pooled connection saves a handshake. Headers carry the client's address and a request id. The proxy streams the reply and counts the result. Request routing, connection reuse and accounting each have a specific owner. Put trusted connection information into forwarded metadata and measure what happened to this individual request. 00:00:46 Equal turns can produce unequal work Some checkouts finish in milliseconds and others wait seconds. Round robin can give every server the same number of arrivals and leave one server holding far more outstanding work. Some requests take 10 ms and some 5 seconds. The smallest is 23. The counts are in this proxy's memory. B becomes 24. B is back at 23. Forgetting this step on an error would make B look busy for ever. A least-requests policy uses observed load when making the next choice. Always decrement on completion, cancellation or failure. A leaked active counter can push traffic away from a perfectly healthy worker. 00:01:30 A user wants the same server twice A cache local to the worker makes affinity attractive. Hash a stable key and use a shared membership view to choose a backend. Then remove that backend and follow where the same key goes. The client's address, or better a user id. Ignore a forwarded address that the client wrote itself. The first server after the point is B. Every request of user 17 reaches B, and every proxy agrees. B's keys go to the next server. Anything kept only in B is gone. Affinity can improve cache locality without making the chosen worker durable. Put state elsewhere if the shopper cannot afford to lose it when the ring changes. 00:02:12 A health check draws the wrong conclusion One server hangs while the others remain healthy. Failure streaks and recovery thresholds trade detection speed for flapping. Health probing also generates real load across the fleet. In this example every proxy probes every backend periodically. Multiply proxies by backends and divide by the check interval to calculate the total probe rate. Its probe gets no answer in two seconds. That is one failure. A and C share the work. Safe requests are tried once more on another server. After a minute without trouble. Once a worker is removed, verify spare capacity. Put a deadline on retries, restrict them to suitable operations, and warm a replacement before restoring its full share. 00:02:58 Drain before replacing the server The release engineer marks server C for retirement. New requests stop arriving, but existing requests may still be active. Removing the process immediately would turn the deployment into customer failures. A deploy tool calls drain. New requests go to A and B. After 30 seconds the few that remain are closed and counted. C can be replaced. Set a drain deadline, observe outstanding work and define what long-lived connections do when time expires. The public address can stay stable while serving machines come and go.