HA of Load Balancer
 for Small Company
          charsyam@naver.com
Agenda
• Why?
   –DNS RoundRobin
• Dedicated Server in IDC
   –Hardware L4
   –Using VIP
• AWS
   –Using EIP
Why?
• Let’s see in beginner’s point of view.
   – How to distribute clients’ requests.
                         Using DNS RR
       CLIENT
       CLIENT             Web Server
                                            DB
       CLIENT             Web Server
       CLIENT
Why?
• Let’s see in beginner’s point of view.
   – How to distribute clients’ requests.
   – But If one web server dies, half requests will fail.
   – And DNS RR needs lots of propagation time.
                          Using DNS RR
       CLIENT
       CLIENT              Web Server
                                                       DB
       CLIENT              Web Server
       CLIENT
Load Balancer!
• LB distributes clients’ requests.

                    Using Load Balancer
       CLIENT
       CLIENT                    Web
                        LB                DB
       CLIENT                    Web
       CLIENT
Load Balancer!
• LB distributes clients’ requests.
   – If one web server dies, LB will get rid of failed server.

                    Using Load Balancer
     CLIENT
     CLIENT                        Web
                         LB                          DB
     CLIENT                        Web
     CLIENT
Load Balancer FAIL
• If LB dies, It is critical disaster.
   – So we need HA of Load Balancer.
                     Using Load Balancer
        CLIENT
        CLIENT                     Web
                          LB               DB
        CLIENT                     Web
        CLIENT
How?
• How to HA of LB
   – It depends on your situation.
• Question?
   – Where do you host your service?
      • IDC, aws
• Let’s go to build.
Dedicated Server in IDC
• Using Hardware L4
   – Could your hosting service support Hardware L4
   – Pros
      • The easiest way to manage
   – Cons
      • Expensive solution.
• Using VIP
   – With HAProxy or Nginx
Hardware L4 #1
• You can choose 2 types of solution.
• Using L4 as LB
                 Using Hardware L4 #1
   CLIENT
   CLIENT                     Web
                      L4                DB
   CLIENT                     Web
   CLIENT
Hardware L4 #2
• Using L4 with LB
  – Hardware L4 can fail, but rarely

                 Using Hardware L4 #2
   CLIENT
   CLIENT                   LB         Web
                L4                           DB
   CLIENT                   LB         Web
   CLIENT
Using VIP
• Virtual IP Address
                                      CLIENT
                                             1.1.1.4
                                      Route
                                         1.1.1.2
                       1.1.1.2                          1.1.1.3
                        1.1.1.4
                       1.1.1.4 is VIP which is allocated 1.1.1.2
Using VIP
• We can give VIP to other Server.
                                   CLIENT
                                          1.1.1.4
                                   Route

                   1.1.1.2                           1.1.1.3
                                                      1.1.1.4
                    1.1.1.4 is VIP which is allocated 1.1.1.2
Software LB with Keepalived
• Virtual IP Address( HAProxy, Nginx doesn’t matter )


      192.168.1.2                  Web Web
       LB1 LB2                     192.168.1.10   192.168.1.11

      192.168.1.3
     Haproxy
                     192.168.1.4
                    Haproxy
                                   Web DB
     keepalived     keepalived     192.168.1.12   192.168.1.100
Software LB with Keepalived
• But you have to check failover time.


                         192.168.1.2   Web Web
       LB1 LB2                         192.168.1.10   192.168.1.11

      192.168.1.3
     Haproxy
                         192.168.1.4
                        Haproxy
                                       Web DB
     keepalived         keepalived     192.168.1.12   192.168.1.100
     Keepalived checks each other.
     And LB2 Keepalived reassign VIP
     to oneself.
Software LB with Keepalived
• Link
  – HAProxy with keepalived
     • http://haproxy.1wt.eu/download/1.3/doc/architecture.txt
     • http://andyleonard.com/2011/02/01/haproxy-and-keepalived-example-
       configuration/
     • http://aaronwalrath.wordpress.com/2011/06/28/configure-haproxy-and-
       keepalived-for-load-balancing-and-reverse-proxy-on-red-
       hatscientificcentos-linux-56/
  – Nginx with keepalived
     • http://www.cyberciti.biz/faq/handling-nginx-failover-with-keepalived/
     • http://evolution.voxeo.com/wiki/kb:swloadbalancingfailover
AWS
• What are different from IDC
   – You can’t use Hardware L4
   – You can’t use multicast
   – You can’t use VIP
• How?
   – ELB( Elastic Load Balancer )
   – EIP( Elastic IP )
ELB
• Auto Scaling is possible.
• ELB doesn’t support Fixed IP.

         CLIENT
         CLIENT                   EC2 Instance
                     ELB
         CLIENT                   EC2 Instance
         CLIENT
EIP
• Elastic IP Address
• We can associate and release EIP like VIP
Weakness of ELB,EIP
• Whenever we use it, we have to pay.
   – It is external IP.
• And it is impossible to apply ELB,EIP in AWS internal
  networks.
How to Handle in AWS?
• There is no Silver Bullet.
• DNS based Solution
   – Using Dynamic DNS Server for internal Network.
   – Using short TTL.
Thank you!

Ha of load balancer

  • 1.
    HA of LoadBalancer for Small Company charsyam@naver.com
  • 2.
    Agenda • Why? –DNS RoundRobin • Dedicated Server in IDC –Hardware L4 –Using VIP • AWS –Using EIP
  • 3.
    Why? • Let’s seein beginner’s point of view. – How to distribute clients’ requests. Using DNS RR CLIENT CLIENT Web Server DB CLIENT Web Server CLIENT
  • 4.
    Why? • Let’s seein beginner’s point of view. – How to distribute clients’ requests. – But If one web server dies, half requests will fail. – And DNS RR needs lots of propagation time. Using DNS RR CLIENT CLIENT Web Server DB CLIENT Web Server CLIENT
  • 5.
    Load Balancer! • LBdistributes clients’ requests. Using Load Balancer CLIENT CLIENT Web LB DB CLIENT Web CLIENT
  • 6.
    Load Balancer! • LBdistributes clients’ requests. – If one web server dies, LB will get rid of failed server. Using Load Balancer CLIENT CLIENT Web LB DB CLIENT Web CLIENT
  • 7.
    Load Balancer FAIL •If LB dies, It is critical disaster. – So we need HA of Load Balancer. Using Load Balancer CLIENT CLIENT Web LB DB CLIENT Web CLIENT
  • 8.
    How? • How toHA of LB – It depends on your situation. • Question? – Where do you host your service? • IDC, aws • Let’s go to build.
  • 9.
    Dedicated Server inIDC • Using Hardware L4 – Could your hosting service support Hardware L4 – Pros • The easiest way to manage – Cons • Expensive solution. • Using VIP – With HAProxy or Nginx
  • 10.
    Hardware L4 #1 •You can choose 2 types of solution. • Using L4 as LB Using Hardware L4 #1 CLIENT CLIENT Web L4 DB CLIENT Web CLIENT
  • 11.
    Hardware L4 #2 •Using L4 with LB – Hardware L4 can fail, but rarely Using Hardware L4 #2 CLIENT CLIENT LB Web L4 DB CLIENT LB Web CLIENT
  • 12.
    Using VIP • VirtualIP Address CLIENT 1.1.1.4 Route 1.1.1.2 1.1.1.2 1.1.1.3 1.1.1.4 1.1.1.4 is VIP which is allocated 1.1.1.2
  • 13.
    Using VIP • Wecan give VIP to other Server. CLIENT 1.1.1.4 Route 1.1.1.2 1.1.1.3 1.1.1.4 1.1.1.4 is VIP which is allocated 1.1.1.2
  • 14.
    Software LB withKeepalived • Virtual IP Address( HAProxy, Nginx doesn’t matter ) 192.168.1.2 Web Web LB1 LB2 192.168.1.10 192.168.1.11 192.168.1.3 Haproxy 192.168.1.4 Haproxy Web DB keepalived keepalived 192.168.1.12 192.168.1.100
  • 15.
    Software LB withKeepalived • But you have to check failover time. 192.168.1.2 Web Web LB1 LB2 192.168.1.10 192.168.1.11 192.168.1.3 Haproxy 192.168.1.4 Haproxy Web DB keepalived keepalived 192.168.1.12 192.168.1.100 Keepalived checks each other. And LB2 Keepalived reassign VIP to oneself.
  • 16.
    Software LB withKeepalived • Link – HAProxy with keepalived • http://haproxy.1wt.eu/download/1.3/doc/architecture.txt • http://andyleonard.com/2011/02/01/haproxy-and-keepalived-example- configuration/ • http://aaronwalrath.wordpress.com/2011/06/28/configure-haproxy-and- keepalived-for-load-balancing-and-reverse-proxy-on-red- hatscientificcentos-linux-56/ – Nginx with keepalived • http://www.cyberciti.biz/faq/handling-nginx-failover-with-keepalived/ • http://evolution.voxeo.com/wiki/kb:swloadbalancingfailover
  • 17.
    AWS • What aredifferent from IDC – You can’t use Hardware L4 – You can’t use multicast – You can’t use VIP • How? – ELB( Elastic Load Balancer ) – EIP( Elastic IP )
  • 18.
    ELB • Auto Scalingis possible. • ELB doesn’t support Fixed IP. CLIENT CLIENT EC2 Instance ELB CLIENT EC2 Instance CLIENT
  • 19.
    EIP • Elastic IPAddress • We can associate and release EIP like VIP
  • 20.
    Weakness of ELB,EIP •Whenever we use it, we have to pay. – It is external IP. • And it is impossible to apply ELB,EIP in AWS internal networks.
  • 21.
    How to Handlein AWS? • There is no Silver Bullet. • DNS based Solution – Using Dynamic DNS Server for internal Network. – Using short TTL.
  • 22.