core practice · system design prompt
L7 load balancer
Design an L7 load balancer in front of N application servers. Pick a routing algorithm (round-robin, least-connections, hashing), explain health checks, and how you drain a node.
The mechanism
A load balancer is the seam between "one address" and "many servers". L4 routes by IP/port (fast, dumb); L7 routes by request content (slower, smart). Health checks and the balancing algorithm (round-robin, least-connections, consistent hashing) decide who gets each request.
Expected evidence
Routing decision tree + health-check loop + a graceful-drain sequence.
Try this drill in the practice workspace →
Hints when you need them
- Sticky sessions cost you flexibility — only enable when needed.
- Health checks should mimic real traffic, not just /ping.
Watch for these mistakes
- Treating the load balancer as a single point of failure with no redundancy
- Round-robin to stateful servers that need sticky sessions
- No health checks, so traffic keeps hitting a dead instance