What is Load Balancing
Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers, also known as a server farm or server pool.
Modern high traffic websites must serve hundreds of thousands, if not millions, of concurrent requests from users or clients and return the correct text, images, video, or application data, all in a fast and reliable manner. To cost effectively scale to meet these high volumes, modern computing best practice generally requires adding more servers.
A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across to one of its servers that is capable of fulfilling those requests in a manner that could maximizes speed and capacity utilisation while also ensuring that no one server is overworked, which could definitely degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. And if a new 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:
- Distributes client requests or network load efficiently across multiple servers
- Ensures high availability and reliability by sending requests only to servers that are online
- Provides the flexibility to add or subtract servers as demand dictates
Benefits of Load Balancing
- Reduced downtime
- Scalable
- Redundancy
- Flexibility
- Efficiency
Load Balancing Algorithms
Different load balancing algorithms provide different benefits; the choice of load balancing method depends on your needs:
- Round Robin – Requests are distributed across the group of servers sequentially.
- Least Connections – A new request is sent to the server with the fewest current connections to clients. The relative computing capacity of each server is factored into determining which one has the least connections.
- Least Time – Sends requests to the server selected by a formula that combines the fastest response time and fewest active connections.
- Hash – Distributes requests based on a key you define, such as the client IP address or the request URL.
- IP Hash – The IP address of the client is used to determine which server receives the request.
- Random with Two Choices – Picks two servers at random and sends the request to the one that is selected by then applying the Least Connections algorithm
Conclusion
Credit: Blog by NGINX
Now, I have shown you what actually is load balancing. I hope that you’d be using it in your project proficiently or at least you’d know what it is in a conversation.
And, if you have any questions or remarks, please leave a comment below and if you really liked my work then you can buy me a coffee.