LOAD BALANCING AND DIFFERENT METHODS OF LOAD BALANCING

Load balancing on Server Side.
Load balancing in computing means, distributing workloads across multiple computing resources such as such as computers, a computer cluster, network links, central processing units or disk drives. Load balancing aims to optimize resource use, maximize throughput, minimize response time, and avoid overload of any single resource. Load balancing usually involves dedicated software or hardware, such as a multilayer switch or a Domain Name System server process.

Server-side load balancer is usually a software program that is listening on the port where external clients connect to access services. The load balancer forwards requests to one of the “backend” servers, which usually replies to the load balancer. This allows the load balancer to reply to the client without the client ever knowing about the internal separation of functions. It also prevents clients from contacting back-end servers directly, which may have security benefits by hiding the structure of the internal network and preventing attacks on the kernel’s network stack or unrelated services running on other ports. A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.
In this manner, a load balancer performs the following functions:

  • Distributes client requests or network load efficiently across multiple servers
  • Ensures high availability and reliability by sending requests only to servers that are online
  • Provides the flexibility to add or subtract servers as demand dictates

It is also important that the load balancer itself does not become a single point of failure. Usually load balancers are implemented in high-availability pairs which may also replicate session persistence data if required by the specific application.

LOAD BALANCING METHODS
Same load balancing methods are used in all the load balancers. Below mentioned methods are used.

  • Direct routing Load Balancing Method
  • The one-arm direct routing (DR) mode is the recommended mode installation because it’s a very high performance solution with very little change to your existing infrastructure.  Direct routing mode enables servers on a connected network to access either the VIPs or RIPs. No extra subnet’s or routes are required on the network. The real server must be configured to respond to both the VIP & its own IP address.

  • Network Address Translation (NAT) load balancing method (two arm)
  • Sometimes it is not possible to use DR mode. The two most common reasons being: if the application cannot bind to RIP & VIP at the same time; or if the host operating system cannot be modified to handle the ARP issue. The second choice is Network Address Translation (NAT) mode. When using a load balancer in two-arm NAT mode, all load balanced services can be configured on the external IP. The real servers must also have their default gateways directed to the internal IP. You can also configure the load balancers in one-arm NAT mode, but in order to make the servers accessible from the local network you need to change some routing information on the real servers.

  • One Arm – Network Address Translation (NAT) load balancing method
  • One arm NAT mode is a fast flexible and easy way to deliver transparent load balancing for your application. The only drawback is the local routing issue.
    We can use it heavily in the Amazon cloud – Why? Because you can’t use DR mode in the Amazon cloud – that’s why

  • Source Network Address Translation (SNAT) load balancing method (layer 7 load balancing)
  • SNAT is a full proxy any server in the cluster can be on any accessible subnet including across the Internet or WAN. SNAT is not TRANSPARENT by default i.e. the real servers will see the source address of each request as the load balancers IP address. The clients source IP address will be in the X-Forwarded-For for header

  • Transparent Source Network Address Translation (SNAT-TPROXY) load balancing method
  • If the source address of the client is a requirement then HAProxy can be forced into transparent mode using TPROXY, this requires that the real servers use the load balancer as the default gateway (as in NAT mode) and only works for directly attached subnet’s (as in NAT mode).  As with other modes a single unit does not require a Floating IP.SNAT acts as a full proxy but in TPROXY mode all server traffic must pass through the load balancer. The real servers must have their default gateway configured to point at the load balancer. Transparent proxy is impossible to implement over a routed network i.e. wide area network such as the Internet. To get transparent load balancing over the WAN you can use the TUN load balancing method (Direct Routing over secure tunnel) with Linux or UNIX based systems only.

  • SSL Termination or Acceleration (SSL) with or without TPROXY
  • All of the layer 4 and Layer 7 load balancing methods can handle SSL traffic in pass through mode i.e. the backend servers do the decryption and encryption of the traffic. Pound/Stunnel-SSL is not TRANSPARENT by default i.e. the backend will see the source address of each request as the load balancers IP address. The clients source IP address will be in the X-Forwarded-For for header. HoweverPound/Stunnel-SSL can also be configured with TPROXY to ensure that the backend can see the source IP address of all traffic.