Create a HTTP load balancer
There are many options to craft the load balancer to your specific needs.
Create a simple HTTP load balancer using the control panel
You create a load balancer by clicking on Load balancers in the left-hand menu under Network. Here, click on Create load balancer. The load balancer will be created under the currently active project.

In the next dialog box, choose a name for the load balancer and specify the datacenter in which it will be located. Here, we choose the name My-test-LB and the data center in Falkenberg. Then, click on Create.

Now you'll see an overview of the load balancer. Under the Settings section, you find the IP addresses for the load balancer—both an IPv4 address and an IPv6 address.

Right now, the load balancer has neither listeners nor servers to route traffic to. The first step is to create a listener. A listener is simply a port that listens for incoming traffic to the load balancer.
Scroll down to the Listeners section. Here, click on Add Listener.

Enter port 80 and select http under Mode. In the following subsection, we will cover certificates, but for now, we can skip that. Click Save to save the listener.

Now you need to add targets—servers—that the load balancer can route traffic to. To do this, click the Add Target button located under the listener. Here, you can either enter the servers' IP addresses manually or select servers from the dropdown menu if they are running on Glesys.

To add multiple servers, click Add Target again. Here, in this example, we select three servers hosted by Glesys. For Port, choose 80, the default port for HTTP. In this example, we also assign the same weight to all targets. This means the traffic will be evenly distributed among them. The higher the weight assigned to a target, the more traffic it will receive.
Ensure that all targets are marked as active. Targets that are not active will not receive any traffic.

If all the servers you specified as targets have an active web server listening on port 80, they will be marked as operational. A green dot will appear in front of these targets. The green dot indicates that the targets are functioning, active, and able to receive traffic.

If any of the targets are not listening on port 80—or do not return a 200 or 300 HTTP status code—the target will be marked with a red dot instead. This indicates that the target will no longer receive any traffic. Targets that are not functioning are automatically removed from the load balancer.
Testing the newly created load balancer
If all the targets are marked green, you can test whether traffic is evenly distributed between them by visiting the load balancer’s IP address and refreshing the page. The IP address can be found under the Settings section of the load balancer.
In this example, all servers have a simple webpage that displays the text Web Server 1, Web Server 2, or Web Server 3. Therefore, we can also test the distribution using a short script, such as:
Running the script with ./test-lb.sh will, in this example, output the following:
If we had made more requests, the distribution among the targets would have become even more balanced.
For more information about targets' weights, see Understand targets' weights. For more information about targets' health checks, see Understand targets' health checks.
Further guides
Create a HTTPS load balancer
Add an SSL certificate to your load balancer and have it serve HTTPS connections.
Create a load balancer using the API
Use the loadbalancer/create endpoint in the API to create a load balancer.
To add a listener to the load balancer, use the loadbalancer/addfrontend endpoint.
To add a target (server) to the load balancer, use the loadbalancer/addbackend endpoint.
To add a certificate to the listener for HTTPS traffic, use the loadbalancer/addcertificate endpoint.
Additional load balancer endpoints are available in the loadbalancer module.
Last updated
Was this helpful?