Efficiently distributing of incoming network traffic across a group of backend servers, also known as a server farm or server pool is called Load Balancing..
Modern high-traffic websites must serve thousands, of concurrent requests from users/clients and should return the correct text, images, video, or application data, all in a fast and reliable manner. To cost-effectively scale our server architecture to meet these high volumes, modern computing best practice generally requires adding more servers to the existing architecture.
load balancer acts as the “traffic cop” sitting in front of your web servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked or has less load, which could degrade performance. If a single web server goes down, the load balancer redirects traffic to the remaining online web servers. When a new web server is added to the server group, the load balancer automatically starts to send requests to it.
In this manner, a load balancer performs the following functions:
- It distributes client requests/network load efficiently across multiple web servers
- It ensures high availability and reliability by sending requests only to web servers that are currently online
- It provides the flexibility to add or subtract web servers as demand dictates
Major Load Balancing Algorithms
We have different load balancing algorithms that provide different benefits; the choice of load balancing method depends on your needs:
- Round Robin – It sequentially distributes requests across the group of servers sequentially.
- Least Connections – In this approach, a new request is sent to the server with the fewest current connections to clients. The relative computing capacity of each web server is factored into determining which one has the least connections.
- IP Hash – The IP address of the client is used to determine which server receives the request.