One day Mickey saw Minnie sitting in the garden. She looked sad. Mickey went to her.
Mickey – Hey Minnie, How are you?
Minnie – I am okay.
Mickey – What happened, you look sad.
Minnie – My teacher asked me to explain Load Balancer in tomorrow’s class, But I have no clue.
Mickey – Oh-kay. I know you always understand with a story.
Minnie – 🙂 and here you go…
Mickey – Think of a busy highway with lots of cars. Due to the heavy traffic the cars are not able to move at a good speed and there are blockages and jams in between.
Now can you think of some way of easing out the traffic.
Minnie – No I cannot
Mickey – No issues, Just imagine if there we have not one but multiple small highways and we can distribute the traffic based on speed, size, destination etc.
Minnie – That would make the scenario much better
Mickey – Yes, so see here we have divided the load with some logic.
Minnie – I am getting but still not clear.
Mickey – let’s take another example, Imagine you are at the airport. You get in the queue for the security check. Suppose there is a single-window for the security check. The queue is very long and is getting longer every minute.
Minnie – I hate waiting in long queues
Mickey – So do I. Now think of a simple solution.
Minnie – Well get more windows and distribute the crowd
Mickey – Yes exactly and that is what is called….
Minnie – Wait! That is what we call Load Balancing? Hurray…!
Mickey – Yes, now lets us come to more real-world example
Minnie – This is getting interesting!
Mickey – Many websites like amazon etc receive millions of concurrent requests and the server should serve all the requests.
Now one of the ways to scale up and meet this high traffic will be to add more servers.
But we still need to balance the load among these servers and ensure no server is overloaded whereas another is idle. Also if one server dies the load can be shifted to another server.
All this is taken care and done by Load Balancer.
Load Balancer can be a physical or virtual device that acts as the “traffic cop” sitting in front of your servers
It routes the incoming requests to the backend servers in a way to increase efficiency, speed and accuracy and maintaining efficient server utilisation.
It can also manage and distribute traffic when a server dies or a new server is added.
Minnie – I get this now.
Mickey – Let us also look at the Wikipedia definition
“In computing, load balancing refers to the process of distributing a set of tasks over a set of resources (computing units), with the aim of making their overall processing more efficient. Load balancing techniques can optimise the response time for each task, avoiding unevenly overloading compute nodes while other compute nodes are left idle.”
Minnie – I understand this now. Thanks, Mickey.
Mickey – I am always here for you 🙂 Let’s go and play now.