If you’ve ever ran into the issue where your server became under load and either didn’t want to, or weren’t able to scale vertically by increasing specs, then the only solution was to scale horizontally with the help of a loadbalancer. Unlike 1&1’s competitors, you use to have to rely on Software solutions such as HaProxy. DigitalOcean’s vibrant community gives a number of topics on the subject:
1&1 though goes a totally different route, and adds a virtual loadbalancer into the mix which you can spin up as many as you need for as many servers as you need. You could go as far as you need to have multiple loadbalancers that map the same cluster of servers, all with different public IPs and handling different functions.
How do I set one up?
As long as you have atleast 2 servers in your Cloud Panel, you can add a Load Balancer via the “Infrastructure” menu.
From there, you simply click your “Create” button and start with your settings:
There’s a few things you’ll want to do before finalizing that last “Create”. Under configurations you can see a port area where you’re going to want to set up your Application’s port. For webservers, forward 80 on the balancer to 80 on all servers.
Why different ports on Balancer from Server
Well let’s say you want to have only 2servers to start off, the servers are mirrored from each other, but you want to test both a Apache based webserver and some Java frontend, both using port 80. Obviously, only 1 application can listen on a port at a time, so for simplicity the Apache uses 80 and the Java frontend uses 8080. Now say you have www.domain.tld, by default HTTP will go to 80 which will load the Apache, and the A record ports to only 1 IP on a server… In comes the power of port forwarding.
In this example, we would need to take advantage of 2 loadbalancers, 2 servers, and our domain. LoadBalancerA would route port 80 to both servers port 80, where as LoadBalancerB would route 80 to both servers port 8080. Then we’ll set the A record for www.domain.tld to LoadbalancerA and create a subdomain “java.domain.tld” to set its A record to LoadbalancerB.
Now depending on which domain you load, you’ll be directed to the webserver you’re expecting to receive from, and be loadbalanced between the 2 servers. Oh and it’s only the price of the 2 servers since LoadBalancing is free.