What is load balancing?

What is load balancing?

A load balancer, or load balancing technology, is a technology designed to distribute the workload between different servers or applications. It goal is to optimise overall infrastructure performance, efficiency and capacity.

Load Balancer OVHcloud

Load balancer: definition

Online traffic has increased exponentially over the past decade. Web users are expecting more and more in terms of access speed, and security — so web servers are in very high demand. A workload optimisation strategy was also put in place — load balancing. This enables a server cluster to handle peak traffic, and provide a backup solution in the event of an outage. This is where the load balancer comes in. It balances the workload between servers, to maintain their capacity at an optimal level. When your website is hosted on our servers with a load balancing IP, it will be protected against downtime and service interruptions.

Whether a load balancer is physical or virtual, it needs to be set up within a dedicated infrastructure. For a hardware platform, a server will act as a load balancer... which is a costly investment. Load balancing software can be installed on a virtual machine (VM). It will then take the form of an application delivery controller (ADC). A virtual load balancer offers more flexibility, and you can use it to automatically scale the workload depending on traffic forecasts.

In both cases, they identify in real time which server is best able to meet a request, so that the cluster maintains a stable level of performance. In the event of a hardware failure, the load balancer is also responsible for switching the workload onto another server.

When a user requests to load a website’s page, the load balancer intervenes between web user’s device and the server. It analyses which server would be best suited to meet this request, then forwards the request to the server. It can also add or remove servers as required, depending on the load.

How does a load balancer work?

Load balancing is carried out by an algorithm, based on the Domain Name System (DNS). A web user accesses the websites via a URL, linked to an IP address. The server contacts the load balancer, which forwards the request to the server. The way that traffic is distributed will then depend on the type of algorithm used. The four most well-known algorithms are: Round Robin, Weighted Round Robin, Least Connections and Weighted Least Connections.

 

Round Robin

This method creates a queue for incoming requests. These are then managed by the load balancer, which distributes them to the servers in the cluster. Requests are assigned sequentially, depending on the availability of the machines. Round Robin does not take into account the urgency of the request, nor the load it will represent for the server concerned. This makes it well-suited to environments where servers have identical resources. But in an infrastructure where server resources are varied, it could assign unsuitable loads to less powerful machines... which could lead to overload.

Round Robin is the most standard method, and serves as a model for other algorithms.

 

Weighted Round Robin

Unlike the standard Round Robin, this method works on the basis of weighted distribution. Each server is assigned a value in advance, depending on its capacity and power. For example, the most powerful server will have a value of 10, and the least powerful server will have a value of 1. The load balancer will then assign more workloads to the most robust machine. This method is best suited to an environment with servers that have different resources — the load is optimised according to their capacity.

 

Least Connections

The two methods above do not take into account the number of connections that the server clusters must manage when the load balancer distributes tasks. Several connections can sometimes accumulate on a server, which can lead to server overload. The Least Connections algorithm fixes that. It takes into account the requests that already exist on the web server during the distribution. The machine with the lowest number of requests receives the next incoming request from the load balancer. However, this algorithm does not take into account the servers’ technical capabilities — so it is best suited for environments with identical server resources.

 

Weighted Least Connections

This algorithm complements the Least Connections method. In an infrastructure with heterogeneous server resources, it takes into account the volume of requests for each machine, as well as their weighting — which is defined by the administrator. As with Weighted Round Robin, the most powerful server has a higher weight. This way, you can maintain optimal load balancing for requests in a cluster. Each new request is assigned to the server with the lowest active connection-weight ratio.

Advantages and importance of the load balancer

The main advantage of a load balancer is that it reduces the response time of a website following user requests. By optimising server workloads, it minimises the risk of technical failures caused by server overload. If one machine becomes unavailable, users will be redirected to another server and still have access to the pages. This means you can guarantee them an optimal experience, with consistent service quality: flexible hosting, high availability, scalability, etc. Furthermore, OVHcloud does not limit your bandwidth or monthly traffic.

The load balancer is still particularly well-adapted to e-commerce, where large fluctuations in traffic can lead to overloads. You can use it to maintain consistent features on your websites, keep a positive online image, and reassure your customers. Specifically, it will prevent baskets from suddenly being empty, and ensure that payment transactions are not interrupted.