Home » Blog » News » Loadbalancing on 3DN

Loadbalancing on 3DN

posted in: Blog, News, Technical 0

Balance the Load


At 3DN we consider teamwork important for proper balance. This is the case for people but it’s also the case for computers. As a small company we have limited resources, so we try to use the resources we have with some balance. To do so we use some excellent opensource tools readily available to everybody:

  • keepalived
  • haproxy
  • FritzBox

With keepalived we can keep one IP address alive between multiple hosts. Hardware sometimes breaks. Such events are difficult to predict. However it’s easy to check from another host if a host is still up and running so we know if the IP address still exists. Keepalived is a program that does that checking. It does so by using a protocol called VRRP.

With haproxy we can listen to an IP address and when a connection comes in we can dispatch it to another IP address or a set of IP addresses.

So we have a setup where 2 hosts run keepalived. When one of these hosts goes down, the other will immediately detect it and take over the IP address. On each of these hosts we also run haproxy which dispatches requests such as HTTP, PHP and MySQL to a farm of servers behind it. In the following chapters we will describe in more detail how this all works for your leisure.


So keepalived is a relatively simple program or at least so it might seem. We will see however that there are some interesting things to keep in mind such as priorities and virtual MAC addresses.


haproxyHAProxy is a genius tool. It does many things that commercial appliances do and more. However it does it faster, cheaper and better than any of those appliances in my opinion. To give a brief visual description of its complexity I have included a picture I found on the internet. I hope the owner doesn’t mind me using it but it resembles part of our own setup so much that I couldn’t resists. This is ONLY a small subset of how we have deployed HAProxy at 3DN and in time I’ll give some more detail of how we’ve set it up at our own serverpark. The picture does show clearly some of the complexities though. What we see in the picture:

  • Several Applications
  • Loadbalancing with keepalived as in 3DN
  • Dual HAProxy servers
  • Multiple MySQL nodes.


Leave a Reply

Your email address will not be published. Required fields are marked *