Here’s my setup. Both http and https connections are working, but on both backends, only the first server entry (server aab) is being forwarded to. The second one (server aaa) never gets hit. If I reverse the order the servers are listed, still only the first one gets hit:
timeout connect 5000
timeout client 50000
timeout server 50000
Just to add a bit more, I have determined that it does indeed hit both backend servers occasionally, it definitely does not do a “round robin” in the traditional sense. After more research, I added a weight setting to the servers, so now it looks like this:
server aab 220.127.116.11:80 weight 50
server aaa 18.104.22.168:80 weight 50
server aab 22.214.171.124:443 weight 50
server aaa 126.96.36.199:443 weight 50
My understanding is that this should force each server to be used equally and alternately, but I am not seeing this behavior.
HAProxy indeed follows roundrobin, but it’s hard to measure outside of very controlled circumstances. In this case, every request was exactly the same, and it was the only traffic hitting these web servers. Notice that it starts on 2? That’s beause I opened this in a browser when I started.
Yours should work the exact same way, however I’ve noticed differences in milliseconds can throw off an observation. For instance, if HAProxy delivers request 1 to server 1, but it’s for a 1MB file, the request 2 goes to server 2 which is answered with a redirect. Request 3 comes in, server 1 has not yet responded to request 1, so request 3 goes to server 2.
If you have this kind of flexibility with your web servers, try the same experiment.
Thanks for the reply. I started working on a more realistic test and I did see significant improvement. HAProxy was working very well and distributing the load equally. It also seems to be rock-solid under load and very efficient. I guess that shouldn’t be surprising considering its reputation and the size of its user base