Brain Dump

Load Balancer

Tags
sys-design

A load balancer is a reverse-proxy which acts as a front for s distributed-system. Requests go into the load balancer and can be sent through multiple servers or databases and then returned to the correct client.

Load balancers are often setup as active-active systems and can be usefule for:

  • Preventing requests from going to unhealthy servers
  • Preventing overloading resources
  • Helping to eliminate a single point of failure (of-course you'll need multiple load balancers to avoid the balancer becoming the SPOF).

Advantages & disadvantages

Advantages:

  • Session Persistence. Issues cookies and memoize routes (if web-apps don't keep track of sessions themselves).
  • All the advantages of a reverse proxy.

Disadvantages:

  • The load balancer can become a performance bottleneck if it does not have enough resources or if it is not configured properly.
  • Introducing a load balancer to help eliminate a single point of failure results in increased complexity.
  • Balancer can become the single point of failure.

Routing algorithms (Layer based, round robin, consistent hashing) todo

See here.