Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    ⚖ Load Balancing vs ⚙ Failover

    Blogs
    programming networking backend server setup deployment
    6
    15
    2538
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • b6
      b6 last edited by b6

      :scales: Load Balancing vs :hourglass: 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 :angry: :angry: 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 :hearts: B6.

      Piumal Kavinda 1 Reply Last reply Reply Quote 7
      • dev_lak
        dev_lak last edited by

        Thanks bro

        1 Reply Last reply Reply Quote 0
        • root
          root Linux Help last edited by

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

          b6 1 Reply Last reply Reply Quote 0
          • b6
            b6 @root last edited by

            @root Thank you bro :)

            1 Reply Last reply Reply Quote 0
            • Chirantha Jananath
              Chirantha Jananath last edited by

              Good article.

              b6 1 Reply Last reply Reply Quote 0
              • b6
                b6 @Chirantha Jananath last edited by

                @Chirantha-Jananath Thx Bro

                1 Reply Last reply Reply Quote 0
                • Piumal Kavinda
                  Piumal Kavinda Linux Help last edited by

                  Good explanation

                  b6 1 Reply Last reply Reply Quote 1
                  • b6
                    b6 @Piumal Kavinda last edited by

                    @Piumal-Kavinda thank you

                    1 Reply Last reply Reply Quote 0
                    • dinlinux
                      dinlinux last edited by

                      Great post. Simple and accurate..

                      b6 1 Reply Last reply Reply Quote 1
                      • Piumal Kavinda
                        Piumal Kavinda Linux Help @b6 last edited by

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

                        root 1 Reply Last reply Reply Quote 0
                        • root
                          root Linux Help @Piumal Kavinda last edited by

                          @Piumal-Kavinda you mean VPS ?

                          Piumal Kavinda 1 Reply Last reply Reply Quote 1
                          • Piumal Kavinda
                            Piumal Kavinda Linux Help @root last edited by Piumal Kavinda

                            @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

                            root b6 2 Replies Last reply Reply Quote 1
                            • root
                              root Linux Help @Piumal Kavinda last edited by

                              @Piumal-Kavinda

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

                              1 Reply Last reply Reply Quote 1
                              • b6
                                b6 @Piumal Kavinda last edited by b6

                                @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,

                                1 Reply Last reply Reply Quote 0
                                • b6
                                  b6 @dinlinux last edited by

                                  @dinlinux Thank you!

                                  1 Reply Last reply Reply Quote 0
                                  • 1 / 1
                                  • First post
                                    Last post

                                  4
                                  Online

                                  3.7k
                                  Users

                                  1.3k
                                  Topics

                                  5.3k
                                  Posts

                                  • Privacy
                                  • Terms & Conditions
                                  • Donate

                                  © Copyrights and All right reserved Lanka Developers Community

                                  Powered by Axis Technologies (PVT) Ltd

                                  Made with in Sri Lanka

                                  | |