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.

Image Source: https://miro.medium.com/max/1400/1*T4TFaAuYumJnIOwNaD1_3A.png

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.

Image Source: https://www.cloudflare.com/resources/images/slt3lc6tev37/25mxQ7enQpLxkGkPA65ThD/dedd9667bc99943c8f224b914307316b/without_load_balancing_diagram.png

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.

Image Source: https://www.cloudflare.com/resources/images/slt3lc6tev37/5XVUMMchWZhrGjDrVk6pU0/40234e77d9f6c0e6cdd8641f26cf9e3c/with_load_balancing_diagram.png

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.

Dineshchandgr - A Top writer in Technology

Principal Software Engineer and Technical Lead focussed on Backend Engineering who likes to upgrade the tech skills and share knowledge to the community