AlgoViz

Load balancing

medium 25 min

A load balancer gives many servers one address, sends each request to a healthy one and hides failures and upgrades.

Where it shows up

The same pattern appears across everyday software.

  • AWS Elastic Load Balancing

    The Network Load Balancer works at layer 4 and, according to AWS, handles millions of requests per second. The Application Load Balancer routes at layer 7 by rules such as path and host.

  • Google Maglev

    A network load balancer in software on ordinary Linux machines, with consistent hashing and connection tracking so that connections survive changes.

  • Anycast at the edge

    One address is announced from many sites, so that Internet routing brings users to a nearby one before any per-server decision is made.

  • Envoy

    A proxy used in service meshes. With equal weights, its least-request balancer compares random hosts and takes the one with fewer active requests.

  • nginx

    Round robin by default, with least_conn, ip_hash and random two as alternatives. For IPv4, ip_hash uses only the first three octets of the address.

  • Kubernetes services

    A stable service name and address stand in front of pods that come and go.