Load Balancer at Scaleway

Server applications failures and lack of scalability can cause real problems for a server. When server applications fail, a node is unavailable to answer requests. In that case, if there is no redundancy, the service is unavailable as long as the server is not back in service. In case of lack of scalability, the load becomes larger than what the node can handle whilst keeping a good latency. In some cases, if the load is too important, the node can become so saturated that it times out. Both of those problems can happen on any website and can cause a lot of trouble. To solve both those issues, Load Balancer provides a significant help.

What Is a Load Balancer?

A load balancer is a system that is designed to spread an incoming flow of traffic across multiple other nodes. The incoming flow of traffic is coming from the Internet through a frontend and is spread on several machines called backends.

When a user arrives with a session, it is routed at an infra level to the load balancer instances that are configured for this IP and port.
The session is then transparently redirected to a backend according to the configured algorithm (roundrobin, leastconn) and the replies are then redirected to the user.

Backends can be any IP in Scaleway, Online by Scaleway, Iliad Datacenter. In the case of private IP, they need to be available on the same region.
Scaleway load balancers are also quickly up and running, usually in less than a second.

Why Use a Load Balancer?

Load Balancer provides two main features: horizontal scaling and high-availability.

In the case of horizontal scaling, it means that an administrator can add or remove servers to a pool of backend servers to spread the load on more or less servers. For instance, in case of a peak of traffic, several servers running the application can be added to the pool to reduce the average load on each of them. Once the peak is over, the administator can withdraw servers from the pool. This elasticity is particulary well suited for the cloud.

Another feature Load Balancer brings to the table is the high-availability. A load balancer is constantly checking whether a node is functionnal or not. In case it is not, the traffic is routed to a valid backend server. By doing so, the application is still available even if some backend nodes are not up.

How Does a Load Balancer Work?

The reliability of a load balancer is ensured using two instances configured in an active/passive setup. If an active instance of the load balancer does not answer to an healthcheck (from our internal monitoring system), the passive is turned into the active load balancer to receive incoming traffic. All of this is performed transparenlty for the user. It typically happens when an hypervisor breaks and instances are migrated to a different hypervisor. Traffic is immediatly routed to the passive instance, the active load balancer that failed is removed and a new instance is spawned to get a new passive.

Load balancers update the networking configuration to route all the traffic to redundant load balancers instances. This features couldn't exist only with instances. Change in the networking configuration are required to achieve this highly available architecture for load balancers.

TLS Passthrough

Many servers today use HTTPS which is built on top of TLS/SSL to encrypt traffic and ensure data integrity with electronic signature. TLS can be used directly with our load balancers using TCP mode. This technique is known as TLS passthrough. In this mode Load Balancer will forward the TLS traffic to the backend servers that will handle the TLS/SSL termination. Customers don’t need to configure anything special on the Load Balancer to use this mode. TLS passthrough also increases security as the certificates and private keys stay under full control of the customers and never shared with Scaleway.

Backend Monitoring with Healthchecks

Healthchecks ensure reliability for the load-balancer because they guarantee that no traffic will be forwarded to an unhealthy backend. Healthchecks are performed by the load balancer on the backend servers to check whether or not they are available to receive traffic. Load-balancers withdraw backend servers that are not passing their configured healthchecks. There is a wide variety of healthchecks (LDAP, HTTP, TCP, REDIS, MYSQL…) available to cover as many types of backends as possible.

Scalability by Horizontal Scaling

Load-balancers provide horizontal scalability to a service and can ensure that enough backend servers are ready to ensure the elasticity of the demand of a service. When the load on a service increases, additionnal instances can be added to the backend servers to spread the load. When they are no longer required, the instances can be turned down and withdrawn from the pool.

Conclusion

Load Balancer is an essential part to build highly available applications.
At Scaleway, we designed our products to be fast, reliable and easy to get started. You can order those load balancers on our website, through Ansible and get started in seconds!

Recommended articles

Understanding Kubernetes Autoscaling

Kubernetes provides a series of features to ensure your clusters have the right size to handle any load. Let's look into the different auto-scaling tools and learn the difference between them.

KubernetesScaling