Load Balancer

Shashwat Singh
3 min readMay 12, 2020

--

What is Load Balancing ?

Let Here is the two containers (A and B) which have same clients and also providing services but as ;

Client 1 Wants to access that services then it render to the container A….

When Client 2 Access the same service then it redirected to the container B …. After some time Client 3 come and access that same service then he redirected to container A……

So, This Whole process is know as Load Balancing.

Why we need load balancing ?

We need Load Balancing to maintain the loads on the server .

Usage:

Lets take an Example of the Google …

So ,Google have thousand ‘s of webserver or thousand’s of IP’s and all the IP’s What are they have those are put exactly same in website ! But as we are the client we never type the different-different type of the IP of the GOOGLE !!

We just go on the Browser and search directly for (www.google.com) . Now the whole scenario will use only one type of the system called LOAD-BALANCER.

When we type (www.google.com) so, we directly hit the google internal LOAD BALANCER & Balancer will maintain there System of load……

For the Load Balancing we have many ALGORITHMS but the famous one is ROUND ROBIN….

Implementation In My Project:

But Here In this project I without the use of any software or Devices I used an trick of DNS Server(This will work as Load balancer for us) ..

First I created our own Docker Network with use of the Driver called BRIDGE….. and Lunch those CMS under this NETWORK …. And under this network we have also attach every WebApp Containers with the same Database which is storing data in every single bit… We have also done one thing that without knowing the hostname or IP’s of our webserver or container we have provided one unique name and our client will connect by the help of that unique name and that unique name will update the DNS.

One Important Thing Client Should be also in Same Network……

Now Clients Have There three Choices :

1. They can connect by the that unique name (network-alias).

2. They can connect by the HOSTNAME.

3. They can connect by the IP:Port No.

GitHub Link: https://github.com/Shashwatsingh22/Load-Balancer

Now Lets See How you can use this project ?
First Clone This Project From the GitHub by the Command …..
$ git clone https://github.com/Shashwatsingh22/Load-Balancer.git

How to Run this ?….
$ python3 main.py

Now You Can Easily Proceed Your Work Easily….

Now Some ScreenShots Of My Project :

Thank You !!

--

--

Shashwat Singh
Shashwat Singh

Written by Shashwat Singh

Cyber Security Enthusiasm || DevOps || Backend Development || Linkedin -https://www.linkedin.com/in/shashwatsing/ || Github - https://github.com/Shashwatsingh22

No responses yet