Website Load Balancing

Load balancing is an important component to increase website capability and reliability. This post is going to look at several key requirements for website load balancing and techniques in load balancer to fulfill those requirements.

  • How to eliminate website downtime through load balancing
  • How to improve website response time
  • How to intelligently distribute content to the users
  • How to achieve disaster recovery of website across at multiple locations
  • How to enhance website security


How to eliminate website downtime through load balancing

No organization can afford website downtime which costs both money and reputation. Website load balancing can monitor health status of each web server instance and then distribute the user requests to active and most available web server instance.

1.Health check against each web server instance

The decent and powerful health check for website is very important for load balancing. To reliably check the web server availability, there are several technologies in load balancing like:

HTTP(S) check (Load balancer issues HTTP Head request and if the web server sends back HTTP responses with predefined status code like 200)

URL check (Load balancer checks the predefined URLs and web server sends back HTTP response with status code 200 or custom response text)

If any web server instance does not response to health check then it will not serve the user requests.

2. Load balancing methods for website

Load balancing method determines how the load balancer distributes the user requests to the web server instances. There are different load balancing methods and it is important to choose the appropriate load balancing methods to best suit your needs.

Round Robin: The load balancer sends user requests to all the active and available web server instances in succession. It implies that all the web server instances got equal processing power and there is no consideration of current load of each web server instance.
Least Connection: The load balancer sends the user request to the web server instance with lowest number of active connections.
Response Time: The load balancer sends the user request to the web server instance with lowest response time.
Source IP Hash: This algorithm allows connections to be distributed to real servers based on the source IP address.

There are several more like ratio round robin, ratio least connection.


How to improve website response time

No one wants slowness of website. There are many factors in website performance like network topology, pipe quality, application design etc. Load balancer provides several useful features to boost website response time.

1.TCP Multiplexing

TCP multiplexing aggregates more data streams into a single TCP connection and hence reuse TCP connections.

The web server instance does not need to manage lots of TCP connections and it will overwhelmingly improve website overall performance.

2.Content Cache

Content caching improves the performance of a web site by temporarily storing data that was recently accessed. While it is cached, requests for that data will be served by the load balancer instead of making another query to a web server behind it.

The result is improved response times for those requests and less load on the web server.

3. HTTP Compression

HTTP content is compressed before it sends back from server to user. The major benefits of compressed traffic include reduced bandwidth costs, WAN latency reduction, and better performance.

4. SSL Acceleration

If you plan to enable SSL/TLS encryption from client browser to web server instance, SSL Offloading can improve web site performance by relieving a web server of the processing burden of encrypting and/or decrypting traffic.


How to intelligently distribute content to the users

This is the layer 7 load balancing coming to play. The load balancer acts as content traffic distributor to specific backend web servers by inspecting HTTP headers and payload.

1. Direct customer device type to specific web server. For instance, if the request came from a cell phone, the request is directed to a server that is capable of serving content that the user can view on cell phone. A request from a computer is directed to a different server that is capable of serving content designed for a computer screen.

2.Direct request based on language. The HTTP Header Accept-Language will be inspected to determine the language used by customer’s browser.

3.Route the traffic to specific backend servers based on URL pattern matching, for instance, any URL containing images will be routed to static content server while other URL redirected to dynamic content backend servers.

4.Route the traffic based on customer’s source IP to different backend servers.


How to achieve disaster recovery of website across at multiple locations

Global Server Load Balancing (GSLB) provides flexible, scalable and high-performance load balancing across geographically dispersed datacenters to provide protection against the effects of business continuity and disaster recovery events. Working as authoritative DNS for the desired domain, it can support a wide range of load balancing algorithms to direct DNS queries across optimal paths to servers at highly-available datacenters.


How to enhance website security

Website security threats are an ever-present reality. Load balancer can help migrate the web site security vulnerability:

1.Web Application Firewall

A decent WAF module shipped with load balancer inspects all bi-directional packets including the SSL-encrypted transactions with SSL offloading to protect against a wide range of security threats. It provides the ability to inspect HTTP, HTTPS and XML as well as protection against OWSAP top 10.

2.Intrusion Prevention System

The IPS module in load balancer can identify common vulnerabilities and migrate attacks by dropping malicious packets.


Scaling a web site can be a daunting task and load balancer can make your life easier if used correctly.