Load balancing is a technology used in the dedicated hosting arena to spread work across a number of servers with the goal of increasing capacity, speeding up response times and avoiding downtime.
As opposed to the traditional route of pointing traffic directly at a server’s IP, network traffic is directed to an IP on the load balancer. It is the responsibility of the load balancer to choose which server to forward this request to. There are 2 factors which help the load balancer make this choice:
- server health checks
- load balancing strategy
Server health checks ensure servers in a solution respond to requests sent to them. There are several methods used by load balancers to assess the health of the servers in a solution, including:
- Pinging the servers in question verifies they are responding and can handle requests. However, this method is not recommended as the required service maybe offline and unable to fulfil requests despite a successful ping response.
- TCP Connect is a more effective check than ping as it specifically checks that the relevant service is responding.
- A Simple HTTP GET request is better still as it establishes that not only is the service responding, but it is responding correctly.
Assuming all servers are “healthy”, the load balancing strategy defines the decision making parameters. Typical strategies include:
- Using Round Robin results in each server taking turns in responding to requests.
- Weighting allows you to specify the ratio of requests each server responds to.
- Specifying that requests should be sent to the server with least number of connections, ensures the best response time.
- Basing the load balancing decision on information within the URL (URL parsing) allows server functions to be specialised with certain servers responding to ASP/Streaming/HTL requests.
- Using information within the HTTP header allows you to divert traffic to servers depending browser used, cookie information and the requested domain.
The use of persistence and SSL offloading are common when load balancing dedicated servers as they allow more control in the solution.
Persistence, or “stickiness”, directs users back to the original server they visited with the purpose of serving stored information, such as the contents of a shopping basket or previously selected settings, again. When using persistence, be aware of the pitfalls as well as the advantages. For example, using IP based persistence often results in the user being directed back to a down server despite healthy servers being available.
Cookie based persistence (used in Layer 7 solutions) is a smarter choice and directs users to an available server when the preferred choice is unavailable.
“SSL offloading” (or acceleration) allows data travelling from user to hosted solution to be encrypted by the load balancer and not the server. Data encryption is server intensive, often affecting the capacity of the server. By offloading this role to the load balancer, data encryption will not affect the server’s ability to perform other tasks.
To ensure we make the most of the benefits of load balancing, servers within the solution must be physically separated and the degree to which you are able to do this determines how bullet proof your solution is:
- Multiple Racks ensure that a solution will not go offline as a result of a very isolated incident and must be employed on every solution as a minimum.
- Multiple Suites are powered by separate power feeds and splitting servers across them results in minor power outages having no affect on the uptime of a solution.
- Using Multiple Datacentres provides the best level of resilience provided by a single dedicated hosting provider. A popular “what if” used in the dedicated server industry is “what if a plane crashes into the datacentre?” – with correct configuration, splitting servers across multiple datacentres ensures a solution will continue to function even if this unlikely event occurs.
Layer 4 vs Layer 7 load balancing
The following features are consistent across both platforms
Methods – Round Robin, Weighted
Health Checking – TCP Connect
Persistence – IP Based
Other features – Multi racks / suites
There are some features however that are exclusive to Layer 7 load balancing
Methods – Least Connections, URL Parsing, HTTP Headers
Health checking – Ping, Simple HTTP GET
Persistence – Cookie Based
Other features – Multiple data centres, SSL offloading