Deployment & Infra
Load balancing levels: multiple-choice review
Six questions that cut across the whole unit. Each one mirrors a call you make while standing up or operating a load balancer — not a definition to recite, but a layer choice or a failure mode to read correctly under traffic.
Confirm you can connect what each layer can see to what routing it enables, and tie the operational knobs — algorithm, health checks, affinity, draining — back to the failures they prevent.
An NLB (L4) fronts your service. Product asks to route /api/v2/* to a new backend pool while keeping /api/v1/* on the old one. What is the honest answer, and why?
Backend request durations vary wildly: most return in 5 ms, a few take 2 s. Under round-robin, p99 latency is bad and one box is always hot. Which algorithm change helps most, and why?
You want end-to-end encryption (nothing decrypts in the middle) AND path-based routing at the edge from a single balancer. What is true?
During a rolling deploy, users hit connection resets mid-request whenever an old instance is removed. The pool is healthy and well-sized. What is the fix?
A service uses cookie-based sticky sessions to keep in-memory user state on one backend. Load is uneven (one box is hot) and that box cannot be drained cleanly during deploys. What is the senior fix?
A team uses DNS round-robin (two A records) as their load balancer. A backend dies and a slice of users keep failing for minutes. Why, and what does a real balancer give you?
The through-line of the unit is one rule: the layer you pick decides what the balancer can see, and what it can see decides what it can do. L4 forwards bytes by IP and port — fast, protocol-agnostic, capable of TLS passthrough, but blind to path, header, and cookie; L7 terminates the connection, reads HTTP, and routes on any of those, paid for in per-request CPU and crypto. On top of the layer sit the operational knobs that decide reliability: least-connections beats round-robin under uneven request durations, health checks pull dead backends but only as fast as their interval, sticky sessions trade even distribution and clean draining for pinned state (so externalise state first), and connection draining lets in-flight requests finish before a backend retires. And DNS round-robin is not a load balancer — no health awareness, failover bounded by uncontrolled TTLs and caches.