4 ms·
As a load balancer, NGINX is subpar in almost every feature comparison, especially at the open-source (free to use) tier. HAProxy gives you the following that
by lukeqsee 6y ago
As a load balancer, NGINX is subpar in almost every feature comparison, especially at the open-source (free to use) tier.
HAProxy gives you the following that are musts for load balancing (in my opinion), that NGINX does not, at least not easily:
1) A HTML (or JSON) stats page that precisely and completely tells you what’s going on at a high-level. A visit to this during outages is often all that’s required.
2) Support for DNS (and other) discovery mechanisms in a flexible way. (This is paid in NGINX)
3) Active health checks (also paid in NGINX)
4) The ACL system, while somewhat difficult to learn, is amazingly powerful.
5) Flexible L7 retries are brilliant.
We replaced NGINX with HAProxy and eliminated a whole class of bugs, micro-outages, and annoyances just by following HAProxy’s best practices.
I still use NGINX when I need a static web file server, though. :)
- apple4ever 6y agoWow that is very helpful. I am going to take a look now!
- raghava 6y agoHAProxy - traffic shaping { load-balancing, req-throttling, health-checks } nginx - { static file serving, good proxy for python/ruby apps, req manipulation with advanced scripting capabilities via lua engine through open-resty [mirroring, WAF(naxsi), url rewriting etc] } A combo of haproxy + nginx would always bring good delight for many practitioners.
- wtarreau 6y agoThis is actually what I often recommend and often encounter in field: haproxy for LB, varnish serving as a smart cache, and nginx for the applications+static file serving. All 3 components are free, combine extremely well because they've grown together, and are extremely efficient. This is important in virtualised or containerized environments where you want to save resources to minimize response time and leave the CPU for the applications. Of course each of them can do a little bit of the other ones' job. This is fine, it allows easier initial deployments, but as your site grows, whichever you initially start with, you'll always end up installing the two other ones to constitute the most robust stack ever. And it's easy to insert one next to the others without having to break everything, which further adds to the fun.
- lukeqsee 6y agoYes. We use all three at different points of the stack for different purposes. It's great.