Overview
Linux can be used as a very capable load balancer for small-to-medium sized organization, or for projects that do not require enterprise level load balancing features – think granular roles and user delegation, and built-in content caching. The following is a list of popular load balancer solutions that can be used on most Linux distributions.
Neither solution is better than the other, as each has its own strengths in weaknesses. The purpose of this list is to show you the most popular solutions, and where each fits best.
Nginx
Most people know Nginx as a simple and fast web server, but it can also be used to serve another purpose – load balancing. It works well with blogs, informational websites, or web applications that are not transmitting or receiving a lot of large files.
One of the benefits of using Nginx is that it can server web content while load balancing other content. You probably do not want it doing both jobs for a large production website, but the extra functionality can be very useful.
When configured as a load balancer, Nginx becomes what is known as a reverse-proxy. This means all traffic to your web server farm, for example, is going to funnel through this box. It’s why it doesn’t scale well when serving large data. The Nginx server’s network interface must be large enough to handle all traffic to and from the backend.
Where it fits
- Informational blogs or websites, and web applications that do not host large large files locally.
- Environments that already use Nginx. Most of the skill set already exists, so less training is required.
Pros:
- Easy to configure and administer.
- Less training requried if you also use Nginx as a web server.
- Fast and efficent
- Supports layer 4 and layer 7 balancing.
Cons:
- Doesn’t scale well for balancing large files and streaming high-quality media.
- All incoming and outgoing traffic funnels through it.
- No built-in high-availabilty.
HAProxy
HAProxy is older than Nginx but functions just as well. It runs very efficiently and very quickly on even the most minimal amount of hardware. It’s very well suited for blogs, informational sites, and any application that doesn’t send or receive a lot of large files.
Where it fits
- Informational blogs or websites, and web applications that do not host large large files locally.
Pros:
- Easy to configure and administer.
- Fast and efficent.
- Supports layer 4 and layer 7 balancing.
- Single purpose load balancer,
Cons:
- Doesn’t scale well for balancing large files and streaming high-quality media.
- All incoming and outgoing traffic funnels through it.
- May need a large network interface to handle traffic.
- No built-in high-availability.
KeepAlived
Keepalived probably isn’t as well known as the Nginx or HAproxy, but it has been around for a lot longer, as a result, is very mature. Like the two above, it’s very simple to configure and maintain.
Where it fits
- Any where you need a highly available load balancing solution. Keepalived is one of the only packages that has HA features built-in.
- Balancing large files and high quality multimedia.
Pros:
- Simple to understand and easy to administer
- Built-in high availability features.
- Supports layer 4 and layer 7 balancing.
- Fast and efficient.
- Not a proxy; less network bandwidth required.
Cons:
- Not available in most mainstream package repositories.