Web Server Load Balancing: Techniques and Best Practices

Web Server Load Balancing: Techniques and Best Practices. In this post, we learn about web server Load Balancing and its different techniques. 

Companies across the globe seek fast system performance and quick responses when it comes to websites and modern applications. Often such high traffic websites must cater to millions of requests from end users as well as clients simultaneously. In such scenarios, a single server may not be able to handle the network traffic. 

Server overload slows down the network, hinders critical business services, and delivers poor user experiences. Thereby, significantly affecting the ROI. Not just the end users, but even the employees are affected due to peak network traffic, often leading to delays and poor productivity.

That is when a load balancer comes in!

What is Load Balancing?

A Load Balancer, also known as a “traffic cop” sits in front of your server and routes incoming requests across multiple backend servers that respond to them reliably. Such a specific group of servers is known as a server pool or server farm. 

If any of the servers slow down, the load balancer reroutes the traffic to the server that is available. It allows you to flexibly add or remove servers on demand.

Efficient load balancing reduces server overload, boosts capacity utilization, and improves the responsiveness of the website or application. Load balancing continuously executes health checks on the server to make sure there is no hindrance in the performance. It even removes slow, poor performing servers from the farm until they are redeemed.

Why Use a Load Balancer?

Moreover, Load balancing ensures an efficient and fast flow of information between the server and end point devices used to access the application or website. Mainly used for the following reasons:

  • High availability: carries out regular health checks on the server to make sure it receives requests. If a server goes down, the load balancer ensures availability by redirecting the request to the server that is online. Thereby, eliminating redundancy.
  • Security:  widely implemented in modern applications, seeing its security features such as DDoS attack protection.
  • Predictive Insights: Load balancing analytics derive insights about traffic bottlenecks. This helps organizations take the necessary measures to mitigate the same and ensure efficient system performance.
  • Handling traffic spikes: allows you to dynamically add servers to cater to the peak traffic hours or scale down if there’s low demand.

What Load Balancer Types Exist?

Load Balancers are categorized into different types, based on their storage type, functionality, and complexity. Following are the different types of load balancers you commonly find:

1. Hardware based Load Balancers

Such types of load balancers have physical hardware with built in proprietary software designed to process huge volumes of traffic across various application types. Hardware based load balancers handle multiple virtual instances on a single device due to their exceptional built in virtualization capabilities. 

2. Software based load balancers

These load balancers are highly flexible as they run on VMs or white box servers and are generally built into ADCs (application delivery controllers). ADCs offer many other benefits such as traffic shaping, caching, and compression.  Software based load balancers are open source or commercial and require installation before use.

3. Virtual Load Balancer 

Virtual Load balancing strikes a balance between hardware and software based load balancing. It deploys the proprietary software on a VM from a dedicated device. It is highly flexible and is quite popular in cloud environments as it automatically scales up or down as per network traffic needs. However, virtual load balancing is often challenging due to limited automation or scalability.

4. Cloud based Load Balancing 

These load balancers leverage the cloud as its underneath infrastructure to balance cloud environments. These are further divided into the following types:

  • Network Load Balancing: fastest load balancing technique. It relies on Layer 4 of the OSI model and refers to the network layer information to precisely route the network traffic.
  • HTTP(S) Load Balancing: relies on Layer 7 and is a highly flexible technique of load balancing. Admins precisely decide where to send network traffic by referring to any information derived from an HTTP address.
  • Internal Load Balancing: somewhat like network load balancing, the only difference being it can balance traffic distribution across the internal infrastructure. 

Load Balancing Techniques

The technique a load balancer uses to distribute the incoming request to a server pool is known as the Load Balancing algorithm. Below given are the various types of load balancing techniques that you use, based on the hosted application type or service type and the capacity of the servers:

1. Round Robin Load Balancing Method

This technique is the easiest to execute, and easy to visualize. It involves rotating the incoming requests to all the available servers in the pool sequentially. It uses each server in turn and sends the next request to the next server within the pool. 

Such a technique is the most ideal for equally configured web servers. However, this method does not consider concurrent connections, current server load, or server responsiveness. It is also problematic for SSL, as there is an increase in SSL negotiations. All these issues are resolved using the Weighted Round Robin technique.

2. Weighted Round Robin Load Balancing Method

As the name suggests, in this technique, a weight is assigned to each server as per the weighting criteria configured by the admin within DNS records. Then, traffic is distributed across the server pool in a round robin method. Most commonly, this criterion is the server’s capacity to handle traffic. The higher the weight, the more requests are sent to it.

This technique is ideal when the list of servers has varying available resources or capabilities. On the other hand, the Dynamic Round Robin technique involves weight assigned to servers based on the real time data derived from the server’s traffic handling capacity.

3. Least Connection Load Balancing Method

The Least Connection load balancing technique involves searching for servers with a low number of active connections when routing new requests. This ensures optimal load balancing on the nodes and services and works great for most instances. Also, it is the most ideal for large volumes of concurrent connections. 

4. Weighted Least Connection Load Balancing Method

The Weighted Least Connection technique involves an admin configuring certain weight criteria for each server. These criteria are based on the server capacity and its active and current connections. Based on these criteria, the load balancer distributes traffic to the appropriate server. 

If there are two servers with a low number of active connections, the load balancer chooses the one with the highest weight.

5. Resource Based (Adaptive) Load Balancing Method

Resource based (adaptive) load balancing technique heavily relies upon agents (custom programs) installed on application servers.  The job of the agents is to transmit information related to server resources, availability, and status indicators further. The load balancer distributes traffic with the help of this information by agents. It consistently queries servers for this information and decides the real server’s dynamic weight with accuracy. In short, it performs regular health checks across the real server. 

Resource based (adaptive) load balancing is perfect in scenarios where each server’s health status is necessary to consider when making load balancing decisions. Say, for example, it could be used for applications with varying workloads where you need to assess server health through detailed application status and performance.

6. Resource Based (SDN Adaptive) Load Balancing Method

Resource based (SDN Adaptive) load balancing technique involves collecting information from an SDN controller and Layers 2, 3, 4, and 7. Load balancer refers to this detailed information about application status, server status, network infrastructure health status, number of the application running, congestion level on the network, etc. This information is further used to make better traffic distribution decisions. 

This load balancing technique is perfect to use for deployments involving an SDN.

7. Fixed Weighting Load Balancing Method

Fixed weighting load balancing technique involves an admin assigning a weight to each server based on their ability to represent relative server capacity within the server pool. 

The server with the highest assigned weight gets all the incoming requests. If this server goes down, the next server with the highest weight takes the load. Such load balancing technique is perfect in a situation where a single server is highly capable of handling heavy incoming requests. And, there are other capable servers as well that quickly take the load when this server fails.

8. Weighted Response Time Load Balancing Method

This technique considers the application server’s average response time to evaluate a specific server weight. This is combined with the number of active connections a server must decide where to route traffic requests. The server with the fastest response time gets the next request. 

The weighted response time algorithm is ideal for situations where the application server’s response time is a crucial parameter to consider. Such an algorithm ensures faster service to the end users as the server with the quickest response time is handling requests.

9. Source IP Hash Load Balancing Method

Source IP Hash load balancing algorithm creates a unique hash key to assign a specific server to the client. This key is generated by joining the source and destination IP addresses of the client request.

A major benefit of this technique is that it recreates the hash key and in case of session failure, the client connects to the same server again. Source IP hash load balancing is useful where a client’s IP address remains the same and it must connect to the same server session that it was using before. This technique is problematic if the client’s IP address changes often.

10. URL Hash Load Balancing Method

The URL Hash load balancing algorithm is somewhat like the source IP hash load balancing. Only here the hash key is generated based on the URL of the client request. This technique ensures client with a specific URL is routed to the same backend server. The main benefit of this method is to avoid duplicate cache.

Thank you for reading Web Server Load Balancing: Techniques and Best Practices. We shall conclude.

Web Server Load Balancing: Techniques and Best Practices Conclusion

With this, we conclude our detailed take on web server load balancing and load balancing techniques. We can prudently say that without a load balancer, it gets overwhelming for organizations to keep up with the millions of client or user requests daily. 

If your website experiences painfully slow performance, it is high time you explore these load balancing methods. Distributing the traffic requests via a load balancer ensures faster system performance, better uptime, efficient resource utilization, and pleasant user experiences. Based on your application or server requirements, choose the most ideal load balancing technique from the list above.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x