Hey, everyone.
And welcome back.
Now, in today's video, we will be discussing about a very important topic of load balancers.
In fact, in most of the organizations that you will see, Load Balancer is one of the key technology
that is implemented across all of them.
So let's go ahead and understand the basics of load balancers.
Now, before we discuss about Load Balancer, let's look into a typical challenge that organizations
used to face before this technology was introduced.
So let's assume that you have a single server and organization has installed a application on this server,
and this server itself is serving all of the production traffic.
Now due to some reason, if this single server goes down, then the entire production traffic is affected.
Now a server can go down due to any number of reasons.
Maybe application is not working, maybe the kernel is not working.
Maybe there is some issue related to hardware.
Maybe there is some issue related to the internet that is connected to the server and so on.
So the aim is that a single server going down should not really affect the production traffic.
And in order to overcome this you have a recommended way of using a load balancer.
So what happens is this revised approach is you create multiple servers.
So now you have two servers and on top of that you make use of a load balancer.
So load balancer is an additional component and this load balancer will distribute the traffic across
both of the server.
So now what will happen is any client who is visiting the website, the request will first go to the
load balancer.
Load Balancer will go ahead and distribute the request depending upon various algorithm that is been
configured here.
In a simplistic term, the request is distributed 5,050%, so first request will go to server one,
second request will go to server two and so on.
So this is a very high level overview about load Balancer.
Now let's go ahead and quickly look into it at a demo perspective.
So for today's demo, very similar to the diagram that we were discussing, we have two servers, we
have server one, server two, and we have a new component of load balancer that is introduced.
Now this load balancer again is basically a server with a software that can do a load balancing across
both of the servers here.
So now when a client wants to open a website, he will not really open up the server one or a server
to.
He'll basically the request will go to the load balancer IP.
So in this case, all of the server has their individual IPS, but the client will basically open up
the load balancer IP over here.
Now before we go ahead and make a request to the load balancer IP, let's quickly open up the IP of
server one, Server two.
Let's look into what exactly is being loaded here.
So for server one, I'll add the IP here and the response is very straightforward.
It states this is server one.
Similarly, let's open up the server two IP here, I'll paste it here.
And again, the response is very straightforward.
This is server two, so very straightforward response here.
Now let's go ahead and make a request to the load balancer here.
So from a new tab, I'll make a request to the load balancer IP.
This time you see, the request went to the server one.
So first request that we made to the load balancer.
IP went to server one.
Let's make a request again.
And this time you see the request went to server two.
Let's refresh.
You see requests again went to server one.
We'll refresh request again, went to server two.
So this is what the load balancer is all about.
Now one important part to remember is that in this specific demo I have used a specific server where
a load balancer based software is installed.
Now, if this load balancer server goes down, then again your entire application also goes down.
So it is very important that whatever technology that you use at a load balancer level, you have to
ensure that this is highly available.
Now, depending upon various cloud provider that you might use, maybe Azure, et cetera, they have
a highly available load balancing solution that is already available, so you do not really need to
worry that the load balancer itself will go down.
This is something that you do not need to worry.
All you have to worry is about your applications itself.
However, if you are hosting your own load balancing based solution in a virtual machine or in a server,
then the high availability part of load balancer again goes into your responsibility.
So before we conclude, let's quickly look into some of the important pointers here.
First is that load Balancer does many things apart from just distributing the traffic among a set of
servers.
Now, one of the important feature of load balancer is health checking of the back end servers.
For example, let's say that the server one is not working due to some reason.
Load balancer can quickly identify that server.
One is not working.
Then what it will do, it will stop sending traffic to the server one.
All the traffic will now go to the server two and after say after 15 minutes it realizes that server
one is back up again.
Then again, it will go ahead and send the traffic in a 5,050% based scenario.
So health checking is one of the very important feature of a specific load balancer.
Also note that there are multiple algorithms based on which the traffic can be distributed to the back
end servers.
So 5,050% is a very simplistic terms.
You might need say 10% should go to server one because server one has a little less hardware size and
90% of the traffic should go to server two because server two has a great hardware.
So you can have X number of different configurations depending upon your use cases.
And along with that load balancer can also support SSL termination and various other features as well.
So this is a very high level overview about the load balancers.
And with this, we'll conclude today's video.