Load balancing

Ahmed Sherief Ahmed ELDakhakhny
    Twitter:@ahmd_sherief
    Facebook:goo.gl/9RKCH
Load-balancing
• Load balancing is a computer networking
   methodology to distribute workload across
  multiple computers or a computer cluster,
  network links, central processing units, disk
  drives, or other resources,
Goals Load-balancing
•   achieve optimal resource utilization
•   maximize throughput
•   minimize response time
•   avoid overload
•   Avoid crashing
?Why to Load-balance
• Scale applications / services
• Ease of administration / maintenance
   – Easily and transparently remove physical servers from
     rotation in order to perform any type of maintenance on
     that server.
• Resource sharing
   – Can run multiple instances of an application / service on a
     server; could be running on a different port for each
     instance; can load-balance to different port based on data
     analyzed.
Load-Balancing Algorithms
• Most predominant:
     – least connections: server with fewest number of flows gets the new
       flow request.
     – weighted least connections: associate a weight / strength for each
       server and distribute load across server farm based on the weights of
       all servers in the farm.
     – round robin: round robin thru the servers in server farm.
     – weighted round robin: give each server ‘weight’ number of flows in a
       row; weight is set just like it is in weighted least flows.
• There are other algorithms that look at or try to predict server
  load in determining the load of the real server.
•   Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating
    system. As the term is generally used, time slices are assigned to each process in equal portions
    and in circular order, handling all processes without priority
server Load-balancing
   SLB = Server Load-Balancer.
?What does a SLB do
• Gets user to needed resource:
   – Server must be available
   – User’s “session” must not be broken
       • If user must get to same resource over and over, the SLB device must
         ensure that happens (ie, session persistence)
• In order to do work, SLB must:
   – Know servers – IP/port, availability
   – Understand details of some protocols (e.g., FTP, SIP, etc)
• Network Address Translation, NAT:
   – Packets are re-written as they pass through SLB device.
How SLB Devices Make Decisions
•   The SLB device can make its load-balancing decisions based on several
    factors.
     – Some of these factors can be obtained from the packet headers (i.e., IP
       address, port numbers, etc.).
     – Other factors are obtained by looking at the data beyond the network
       headers. Examples:
         • HTTP Cookies
         • HTTP URLs
         • SSL Client certificate ??
•   The decisions can be based strictly on flow counts or they can be based on
    knowledge of application.
SLB: Architectures
• Traditional
  – SLB device sits between the Clients and the
    Servers being load-balanced.
• Distributed
  – SLB device sits off to the side, and only receives
    the packets it needs to based on flow setup and
    tear down.
SLB: Traditional View with NAT
                                    Server1



Client                    SLB       Server2



                                    Server3
SLB: Traditional View without NAT

                                  Server1



Client                  SLB       Server2



                                  Server3
SLB: Distributed Architecture
                                        FE    Server




   Client                               FE    Server




                                        FE    Server

   FE: Forwarding Engines, which are
. responsible for forwarding packets
  They ask the SLB device where to
                       .send the flow   SLB
Distributed Architecture: Sample Flow
                                                                                                    Server1
            TCP SYN: 1
                                                                        .flow goes to Server2: 4

   Client                                            FE
                                                                                                    Server2

                         .FE asks where to send flow: 2


                                                                                                    Server3
                                                          .Service Mgr tells it to use Server2: 3




                                                   SLB
                                                                                                    Server4

 .Subsequent packets flow directly from Client to Server2 thru the FE
            .The FE must notify the SLB device when the flow ends
sources
• Wikipedia
• Technology Integration: RSerPool & Server
  Load-balancing (slides) by Curt Kersey, Cisco Systems
  Aron Silverton, Motorola Labs
Thank you

Twitter:@ahmd_sherief
Facebook:goo.gl/9RKCH

Load balancing

  • 1.
    Load balancing Ahmed SheriefAhmed ELDakhakhny Twitter:@ahmd_sherief Facebook:goo.gl/9RKCH
  • 2.
    Load-balancing • Load balancingis a computer networking methodology to distribute workload across multiple computers or a computer cluster, network links, central processing units, disk drives, or other resources,
  • 3.
    Goals Load-balancing • achieve optimal resource utilization • maximize throughput • minimize response time • avoid overload • Avoid crashing
  • 4.
    ?Why to Load-balance •Scale applications / services • Ease of administration / maintenance – Easily and transparently remove physical servers from rotation in order to perform any type of maintenance on that server. • Resource sharing – Can run multiple instances of an application / service on a server; could be running on a different port for each instance; can load-balance to different port based on data analyzed.
  • 5.
    Load-Balancing Algorithms • Mostpredominant: – least connections: server with fewest number of flows gets the new flow request. – weighted least connections: associate a weight / strength for each server and distribute load across server farm based on the weights of all servers in the farm. – round robin: round robin thru the servers in server farm. – weighted round robin: give each server ‘weight’ number of flows in a row; weight is set just like it is in weighted least flows. • There are other algorithms that look at or try to predict server load in determining the load of the real server. • Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating system. As the term is generally used, time slices are assigned to each process in equal portions and in circular order, handling all processes without priority
  • 6.
    server Load-balancing SLB = Server Load-Balancer.
  • 7.
    ?What does aSLB do • Gets user to needed resource: – Server must be available – User’s “session” must not be broken • If user must get to same resource over and over, the SLB device must ensure that happens (ie, session persistence) • In order to do work, SLB must: – Know servers – IP/port, availability – Understand details of some protocols (e.g., FTP, SIP, etc) • Network Address Translation, NAT: – Packets are re-written as they pass through SLB device.
  • 8.
    How SLB DevicesMake Decisions • The SLB device can make its load-balancing decisions based on several factors. – Some of these factors can be obtained from the packet headers (i.e., IP address, port numbers, etc.). – Other factors are obtained by looking at the data beyond the network headers. Examples: • HTTP Cookies • HTTP URLs • SSL Client certificate ?? • The decisions can be based strictly on flow counts or they can be based on knowledge of application.
  • 9.
    SLB: Architectures • Traditional – SLB device sits between the Clients and the Servers being load-balanced. • Distributed – SLB device sits off to the side, and only receives the packets it needs to based on flow setup and tear down.
  • 10.
    SLB: Traditional Viewwith NAT Server1 Client SLB Server2 Server3
  • 11.
    SLB: Traditional Viewwithout NAT Server1 Client SLB Server2 Server3
  • 12.
    SLB: Distributed Architecture FE Server Client FE Server FE Server FE: Forwarding Engines, which are . responsible for forwarding packets They ask the SLB device where to .send the flow SLB
  • 13.
    Distributed Architecture: SampleFlow Server1 TCP SYN: 1 .flow goes to Server2: 4 Client FE Server2 .FE asks where to send flow: 2 Server3 .Service Mgr tells it to use Server2: 3 SLB Server4 .Subsequent packets flow directly from Client to Server2 thru the FE .The FE must notify the SLB device when the flow ends
  • 14.
    sources • Wikipedia • TechnologyIntegration: RSerPool & Server Load-balancing (slides) by Curt Kersey, Cisco Systems Aron Silverton, Motorola Labs
  • 15.

Editor's Notes

  • #11 In #2, when the SLB device asks where to send the flow, it formats the request giving the src ip/port and dst ip/port . Once the decision is made, the SLB device can remember the decision, so it can build its own session persistence tables. For ip-only session persistence, SLB device will recall that this src ip is going to the PE ip/port determined by the ENRP server . Note: the ENRP server can be getting dynamic feedback on server availability via its “admin network” that i show here as a separate backend network – you don’t have to have a separate network for it .
  • #13 The FEs do not make any decisions. All decisions on where to send the flow is done by the SLB device . When the flow gets terminated, the FEs tell the SLB device. That way the SLB device can keep track of flow counts. Tracking flow counts is critical to keep load distribution even .