Load balancers distribute requests from clients across multiple resources (e.g. servers, services, or databases) allowing for horizontal Scaling. This site provides a nice visual of load balancing1. Load balancing can be implemented with Hardware, software (e.g. HAProxy), or with cloud services (e.g. Amazonâs ELB).
Additionally LBs also allow you to:
- Avoid requests going to unhealthy services
- Eliminates single points of failure
****Routing Choices****
- Layer 4: LB does not operate on the contets of the packet makes routing decisions based on the transport layer info such as source/destination IP and ports.
- Layer 7: This is application layer, with the LB terminating the network traffic, reading the message, and making a routing decision.
- Round robin
- least loaded
- session based
1. Rose, S. Load Balancing. (2023).