What Is Load Balancer?
Load balancers are providing a way to control our applications backing services traffic.
Lets give a real-life example: for instance Lets assume we have a website which provides to users easy shopping, like an E-Commerce website. If one of the user wanna get in this website the users request will go to the service and get the response what the user is asking for but what if we have one million user then there will be too many request and in this case services may be over request. In that kind of platform we would have more services for users and for controlling which user get contact with which service and in this way Load Balancer is helping us to controll our Services traffic. When the user want to contact with services the Load Balancer are directting to the service if the service is available and working.
Lets get some scenarios which are Load Balancer Algorithms;
1.Round Robin: This algorithm says that, if you have 3 service which is getting direct by Load Balancer in client’s each request the Load Balancer will send request with turn and if you have three after three of them using then it will back to the first one.
2.Random Load Balancing: This algorithm works smillarly with Round Robin but it send the request randomly or it can send request with a random range like from 1 to 10 to the second service.
There are more algorithms but this two are which I had come across and wanted to write about them to make a clear understanding of what are Load Balancer for.
Load Balancers are a way to make our processes stateless because with Load Balancer our backing services are not sharing data with each other and each service is self-contained.
References:
https://www.enjoyalgorithms.com/blog/types-of-load-balancing-algorithms