⚖ Load Balancing vs ⚙ Failover


  • Ethical Hacking & Pen-Testing

    ⚖ Load Balancing vs ⌛ Failover


    Apart from Application Development, To become a DevOps Engineer or System Admin you need to learn some production level deployment and maintenance technique to design better server architecture to provide high available service.

    In this small blog, We will see about 2 important things,

    1. Load Balancing
    2. Failover

    Both are server setup techniques to provide High Available or Zero Downtime services.

    Let's See one by one.


    The problem

    When you deploy our application. The server will serve the service to our clients.
    The client will send a request to server, Then our server will response to client.

    When so many clients use our service / app, They will send millions of requests per second. Everything has a limited capacity. We can do limited tasks using our two hands.

    Like that Server will handle only limited requests per second (around 1000 req/ sec But it depends on the internal architecture).

    In above case, When server meet the maximum limit, It will get trouble to process the requests. So the server will stop service / hang automatically. This is what we called Server Down. In this case, Client's will not access our service / application / website which is hosted in that perticlular server.

    To avoid this problem, some server softwares automatically decline the clients' requests when reach limit. But this will create a bad opinion 😠 😠 on our users' or clients' mind about our service. They will be disappointed when they couln't access our service.

    Here we need to implement Load Balancing or Failover.


    The Load Balancing

    The name will give you a idea. Just think balance the load.

    Load Balancing means divide and distribute the traffic (requests) between more than one servers.

    For example
    You have 3 servers, Each server will handle 1000 requests per second.

    When you receive 2500 requests per second, The load balancer will divide the requests and serve to 3 servers something like,

    Server 1 - 900 Req / S
    Server 2 - 900 Req / S
    Server 3 - 700 Req / S

    Here your servers will work together without getting stucked.

    Load Balancing


    There are 2 types of load balancers.

    1. Physical Load Balancer
    2. Logical Load Balancer

    Physical load Balancer

    This is a device looks like a network switch .

    Physical load Balancer

    Connected with servers to balance incomming traffic.

    Physical Load Balancer


    Logical Load Balancer

    Thit will run as a service inside the main server or proxy. It will receive all requests then transfer to other services in same server or subservers.

    Something like this,

    Main Server - yourapp.com

    The main server will get request, Then will forward & balance between below services.

    App1 - localhost:80
    App2 - localhost:8080
    App3 - localhost:8000
    App4 - localhost:8001

    The Nginx is a famous web server with built-in reverse proxy & load balancer

    Sample Load Balancer Configuration of Nginx.

    http {
        upstream myapp1 {
            server srv1.example.com;
            server srv2.example.com;
            server srv3.example.com;
        }
    
        server {
            listen 80;
    
            location / {
                proxy_pass http://myapp1;
            }
        }
    }
    

    Click Here to Read More About nginx Load Balancing.


    Failover

    Failover is little different from load balancing. Here we are not going to balance the load.

    Here also we need more than 1 server. But we will fireup other server instead of one, When that server went down.

    Confusing? For Example

    We have following 2 servers.

    Server 1 : 192.168.8.100

    Server 2 : 192.168.8.103

    Here, We don't use both servers at the same time. We will start the second server, When the first server went down.

    When our first server stop working, The failover machanism automatically turn-on server 2.


    These are the main concepts of Load Balancing and Failover. Hope now you have learn new thing.

    Just put a comment, If you want to write about anything else. Or if you have any questions.

    Thank you!

    With ♥ B6.



  • Thanks bro



  • Good work bro. keep posting. this is very clean articles, Thanks


  • Ethical Hacking & Pen-Testing

    @root Thank you bro 🙂



  • Good article.


  • Ethical Hacking & Pen-Testing


  • Linux Help

    Good explanation


  • Ethical Hacking & Pen-Testing

    @Piumal-Kavinda thank you



  • Great post. Simple and accurate..


  • Linux Help

    @b6 I have a question , can this two methods apply for virtualised servers ?



  • @Piumal-Kavinda you mean VPS ?


  • Linux Help

    @root Not exactly , nowdays most companies using virtual servers by hyper v and Vmware so load balancing and fail over technologies must be support that platforms .

    .alt text



  • @Piumal-Kavinda

    ahh ok, this can work with virtual architectures. no problem bro


  • Ethical Hacking & Pen-Testing

    @Piumal-Kavinda Yes, You can apply. The logical load-balances handles the virtual instances. And physical machanism used to manage the parent instance.

    And nowadays no one using Virtual Architecture with Virtual Machines because of performance and scalability. Use containers instead of VMs.

    Docker & Kubernate are rocking today's architecture,


  • Ethical Hacking & Pen-Testing

    @dinlinux Thank you!