Is HAProxy still used?

Is HAProxy still used?

Was it ever?

My answer has always been that it was not so good to start with and the tool was so under-documented and complicated that it wasn't worth the learning curve. I think this is wrong or at least, we need to re-evaluate how HAProxy compares to NGINX. Since HAProxy can scale to multiple data centers and support high availability for any of its processes (websites, domains, etc.), HAProxy can be great for a number of use cases that NGINX can't (yet).

I want to be clear that in my mind, NGINX is still the most important web server tool today. The best website example may be Netflix (), but other sites are available such as: Reddit (). YouTube (). Dell.com () I think that most of the other sites use HAProxy, for all the right reasons. In many cases, NGINX is too heavy weight, while HAProxy is more appropriate for a low latency, high availability setup. I have been using HAProxy daily since 2024 and I'm still using it today. I have never deployed a site using NGINX until 2024 and I have used HAProxy in production for several years.

In my opinion, some of the fatal flaws for HAProxy listed by others (see here and here) do not necessarily reflect what has actually been used on a real world project. HAProxy is still a fine product that is not going away, or at least, not anytime soon. While NGINX is very well documented and it has the superior documentation, it is not actually the superior product.

If you choose to use HAProxy for load balancing, keep in mind that there is a learning curve.

Is HAProxy a good load balancer?

I've been playing around with HAProxy and the results are very promising.

It performs well in nearly all situations. However, it's possible to misconfigure HAProxy such that your application does not function correctly. Let's take a look at the following configuration:

It should be noted that the HTTP traffic is directed to the web server, but the HTML traffic is sent to the HTML server. I would expect that the web server is overloaded, and should stop accepting new connections. But HAProxy will still attempt to send requests to the web server. Why? Because we did not specify that the requests be redirected to the web server. We used a catchall redirect rule. If were to remove this rule, we would see that the web server is now overloaded.

So what do we do when HAProxy is misconfigured? We should probably remove it and use something else. But in a lot of cases, we want HAProxy to work for us. In particular, when we want to put together a load-balanced service, we want HAProxy to work for us.

With HAProxy, this means adding or modifying the backend to redirect traffic. For example, you might add the following directive to an http or https backend: backend webserverA. Usebackend webserverB if HTTP/1.1 redirect scheme http code 300. Redirect permanent /myurl if HTTP/1.0 This tells HAProxy that any HTTP/1.1 request to will be sent to backend webserverB. Note that in this configuration, HAProxy uses the scheme attribute to determine if a request is HTTP/1.0 or HTTP/1.

The issue is that the redirects have to go to the right server, regardless of which port the request was received on. Let's take a look at an example: This configuration redirects all http traffic to the load balancer to the backend that contains an external IP address. The issue is that this would not be the correct redirect if the request was made from a local machine that used a different IP address.

How to setup load balancer in HAProxy?

We are already implementing Lighthouse - which is load balanced by HAProxy 1.

8 - It works perfectly except for single node failure.

What should we do in order to have load balancing working correctly? Lighthouse has no provision for automatic failover. When it fails, the traffic is dropped until you bring up another instance.

You need to create a mechanism for switching from the current server to another server, or your site can experience downtime. A common mechanism is to use HTTP 503 errors. (The web server should return an error message when the 503 code is received; that message will be served if one or more back-end servers are available.) That is a good way to tell the browser that the resource can't be found. The Apache manual has some details of how to implement it.

If there are multiple availability zones (which is not uncommon these days), you'll want to make sure the load balancer can balance requests across zones as well.

Related Answers

How much does HAProxy load balancer cost?

HAProxy is a highly versatile and capable load balancer. It also lack...

What is HAProxy used for?

In a nutshell: If you need a load balancer with stateless backend servers, HAProx...

Can HAProxy run on Windows?

Yes, it can. The latest version of the HAProxy daemon, 1.6.1, has been...