Is HAProxy a good load balancer?

What is the use of HAProxy?

The short answer is: you can use it for load balancing (if you need to), performance-testing, traffic shaping, rate limiting, URL redirecting, and many other things. But really, what does HAProxy do? First off, you should know that there are multiple types of Load Balancing software. There are many of these products in the market, all of which provide the same function: making sure that incoming requests are distributed evenly across two or more machines. There are three basic ways that this is achieved:

Round Robin Load Balancing Round Queue Load Balancing Least Connection Rate Limiting. In this article, we will cover Round Robin Load Balancing. This type of load balancing is widely used in web servers and the way it works is relatively simple. The software keeps track of the currently active connections, and tries to spread the workload evenly between the server boxes. In most cases, it uses only one or two of the available connections on a box at any time. So, how does it achieve this?
In this example, we have two servers A and B, connected through an ethernet network with IP addresses 192.168.100.10 and 192.20 respectively. From the perspective of our TCP client (or browser), the requests look as follows:

10 : Port 443 (HTTPS) : 192.10 : Port 80 (HTTP) 20 : Port 443 (HTTPS) : 192.20 : Port 80 (HTTP) Round Robin load balancing can be implemented in HAProxy in a number of ways. The most simple way is to use the hash algorithm, but if the server is running on the same machine, it can be used as well. Below, we will show you an example of how it works using Apache web server. This method has its limitations, but still works very well.

Let's create a virtual host, called website.com, that will host our website. We will also assign this domain to a TCP service. All of this can be done using the following commands:

Sudo apachectl start. Sudo a2ensite website.com sudo sysctl -w net.inet.tcp.

Is HAProxy load balancer free?

I'm going to try HAProxy in place of Apache as a web server for a new application and I don't have any experience with HAProxy.

Here are my concerns: Load balancing. Does the load balancer do its own load balancing or does it simply distribute requests among the individual front-end servers? SSL termination. How does this work? Is there a way for the load balancer to terminate SSL traffic or will that be performed by each of the front-end servers? Or will the load balancer function similar to Nginx (only providing upstream HTTP connections)? Reliability. Is HAProxy considered a reliable web load balancer in the sense that if one of the front-end servers fails, load balancer will be able to redirect traffic to the other servers automatically or will HAProxy still act as a non-reliable web load balancer? (It doesn't make much sense to me that the load balancer itself could fail while clients continue to get the contents served from the server that serves the load balancer which I assume is the case). Thanks. Edit: What about HAProxy as a proxy? Would that be a viable configuration since it also does SSL termination and can direct unauthenticated requests to certain servers? John BJan 4 '12 at 15:14. 1

As a long time apache user, I would argue that HAProxy falls outside of "load balancer" category. While the goal is the same, in practical terms a load balancer is meant to distribute / balance traffic across several machines or servers. At worst, you might use a load balancer only to direct your clients to different servers (ie. Failover) but as far as I know haproxy has no capability to perform load balancing unless you use the "global" functionality - which I don't believe is what you are looking for.

GibJan 4 '12 at 16:25. 2 Answers.
HAProxy offers the concept of "cluster," as mentioned in the answer by jimaxxxi.

Is HAProxy a good load balancer?

So, HAProxy is an interesting, fast, and powerful HTTP load balancer.

So, if we're a little confused with it at first, then what the hell is the use of all these other load balancers, and why are we still using them if HAProxy is so good? Is it even a good choice for a modern network? Let's answer all these questions before getting to some quick tests I ran that showed how fast, efficient and stable it really is. Let's face the fact, yes HAProxy has been here since 1997 and I do know the feeling from using it when it was not as popular as it is today. When it comes to a load balancer, nothing is perfect because it's just a tool, and a tool can't save the world if you don't use it. I'll say it again: a load balancer is a tool! But, it is possible to use it on a daily basis by understanding all of its potential downsides and pros while working with it!

HAProxy is a reverse proxy - reverse proxy is also known as transparent proxy or edge proxy. A reverse proxy forwards the request to other servers based on certain rules. Now, let's think about that for a second, do you remember what an HTTP web server is? Well, an HTTP server is basically a machine or software that listens for connection from the end user and serves data back to the client. It is a server, which means that it is responsible for receiving requests and then sending data back to the clients, also known as a web server.

In addition to accepting connections from clients and serving data back to the clients, it often proxies the traffic of the client-side to the backend servers for further processing or distribution. A typical reverse proxy works as a man-in-the-middle (MITM), which simply means that it acts as a proxy between the clients and the actual origin servers for various reasons.

There are two main advantages when a reverse proxy is used over another solution, which is HTTP accelerator. HTTP accelerator is essentially the server itself, but a reverse proxy changes the client's requests and makes it look as though it is actually going to the correct server. This is achieved through the use of a DNS change on the original request from the client.

How to setup load balancer in HAProxy?

Is there a way to use HAProxy as load balancer for website (for web application)? I am very new in haproxy, but I want setup a proxy server in haproxy. All these information is taken from this link : I want use HAProxy to be able to use it as load balancer in front of other HAProxy server. (which already set up).

How to setup HAProxy as load balancer for the website? It is possible using the frontend.frontend and frontendip parameters.

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...