Hello Load Balancer

Hello Load Balancer

·

2 min read

Intro

So firstly, load balancing is simply, as by the name -balancing or managing the load on your server. Simple. right?

It ensures that no single server is overwhelmed with traffic, preventing bottlenecks and enhancing the overall reliability of the network.

But wait. 🫤

What actually is "load", how is it being "balanced", and who the heck is even balancing it? Let's understand this.

Understand The Load Balancer

Load refers to the number of clients or anything that is requesting your services or resources.

Consider a scenario where a server can "serve" 1000 clients, and you bought 3 such servers to serve your clients.

Now let's take a situation where demand surges to 2500 clients concurrently seeking your services. Since each server can only serve 1000 clients, here comes the load balancer into the equation. It evenly distributes traffic among multiple servers, achieving efficient resource utilization. This is what balancing is about.

You would have often heard "We are getting too much traffic onto our servers", it means that the "load"(traffic) is more than the servers can handle, or in simple terms there is more number of clients than the servers can handle.

Meet The Load Balancer

Now to the part, "who" does this? What does a load balancer look like?

Well load balancer is just another server, although it doesn't process the client requests like backend servers but rather handles it.

You can either use some cloud provider's service for doing this. or If it's your own server you just need to write a few lines in the configuration file of that server.

Consider the below image for a better understanding.

Let's say I'm using NGINX to set up my server. By default, it has a round-robin (a load balancing technique) implemented to balance the traffic on the backend servers. If I need to implement a technique let's say "ip hash", I just need to write "ip_hash" in the upstream cluster/block like below. The 'ip-addr-server' text here refers to the IP of the backend servers in the network.

Image

Conclusion

So that's it, that is what a load balancer is, and this is what it does. In conclusion, Load balancing is an essential component in modern network architectures which helps in enabling high availability, scalability, and improved performance of your services.