Hacker News new | ask | show | jobs
by brett 6109 days ago
Having Nginx in front is a lot more flexible that just having HAProxy listen on port 80. For example, it can serve static files and do redirects both of which don't need to pass through the whole load balanced stack.

They could use Nginx -> HAProxy -> Nginx(w/ passenger), but the Apache version feels slightly more mature (e.g. it has some config options that the Nginx version lacks) and it's likely they were already using it before the Nginx version came out.

1 comments

Why use HAProxy at all?
There is an interesting "Zero-Downtime Restarts with HAProxy" Tutorial that he might have implemented:

http://www.igvita.com/2008/12/02/zero-downtime-restarts-with...

It's better at load balancing. For example it handles app servers that have gone down more gracefully. Also it generates an awesome stats page that gives you way more info about what's going on than you can get from Nginx.
Yep! We used nginx's fair balancing module before switching to haproxy. It also helps me do rolling restarts/hot deployments in a nice way.

It's really a great piece of software. Kudos to Willy.

PS - you're also correct about the nginx->haproxy->apache. nginx makes a fabulous front end and I just plugged in Apache/Passenger where Mongrel used to be. I like that 1) I can easily plug in something else in the future and 2) Passenger on Apache is very stable. Nginx support is newish and I'm running stripped down Apaches that only do Passenger, so I'm not too fussed about it.