Lesson 16 of 17
7. Load Balancers, Reverse Proxies and API Gateways

Sources

3 min read+10 XP

Source notes

  • Layer 4 and layer 7 refer to the transport and application layers of the OSI networking model.
  • Smooth weighted round robin as implemented here follows the algorithm used by NGINX's upstream module (described in NGINX's source and documentation).
  • "Pick two at random, use the less loaded" (the power of two random choices): Michael Mitzenmacher, "The Power of Two Choices in Randomized Load Balancing", IEEE Transactions on Parallel and Distributed Systems, 2001.
  • VRRP (Virtual Router Redundancy Protocol): RFC 5798. Keepalived is a common open-source implementation used for load balancer failover.
  • Health checks, thresholds and connection draining (deregistration delay) are described in cloud load balancer documentation (for example AWS Elastic Load Balancing target group health checks). Defaults vary by provider.
  • All bookstore traffic numbers are illustrative assumptions. Arithmetic computed 2026-10-08.
  • Level 3 and Level 4 code: tested 2026-10-08 (code/ch07_load_balancer.py, all checks pass).