What is a Load Balancer? — Every Software Engineer must know
Hello everyone. In this article, we are going to see about the load balancer, which is one of the important components of a distributed system. We will see about load balancer and its benefits to start with. Then we will look into the different types of load balancers and also about the various load-balancing algorithms. We will then go through container load balancing and end this article by comparing the load balancer with the API Gateway. Let's get started.
What is a Load Balancer?
In a client-server architecture, there will be a lot of clients like mobile, web, IoT, and so on. To serve these clients, there will be not just one Server but a lot of them based on the traffic load. Modern high‑traffic websites must serve hundreds of thousands of concurrent requests from users or clients and return the correct text, images, video, or application data. To meet these demands, we need to add a lot of processing power in the form of adding more servers.
In the above diagram, it can be seen that Server 1 is overloaded without a load balancer.
In order to utilize all the servers efficiently, we need to distribute a load of incoming requests among them. And this process of distributing incoming network traffic across a group of backend servers is called Load Balancing.
The load Balancer is the software component that is designed for load balancing and it sits in front of the servers. It is also called a reverse proxy as it takes the request on behalf of the Servers and routes it to them. The load balancer manages the requests efficiently and makes sure that the incoming requests are served quickly. In the event of a Server crash, the load balancer would redirect the traffic to the other active servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.