Re:Ask HN: What load balancing software do you use ?
by anotherjesse on Saturday May 03, 2008 @10:34PM
(#180577)
I do run them on the same machine for userscripts.org - although I have used them on seperate machines on other projects - nothing public though :)
I use Nginx for things like serving from memcached (someone else commented on that), rewrite rules, redirects, logging, ...
Also Nginx is good because I have 5 different virtual hosts on the box, so I can proxy to different app servers based on hostname/location.
Here is my commented nginx config for userscripts.org:
http://pastie.textmate.org/private/rmp4b9xpwevxnckumxmq0a
Here is my haproxy config for userscripts.org: http://pastie.textmate.org/private/rbxzpeu7e0gjkkc6r04ta
Nginx does have weighting options, but I was unable to get the affect of having only 1 request hitting an app server at any time (it could be possible, but switching to HAProxy was easy, and in a month I've not had a second of down-time, and I restart all the app servers every hour via log rotate) Not having request queue at the app server level helped, combined with HAProxy pinging for health between requests has lead to faster requests, as queueing at the app server level leads to delays if you get behind a slow request.
- Do you run the two products on the same physical machine ?
- What does Nginx do that HAProxy doesn't ? (i.e. why not just stick with HAProxy ?)
- I noticed that Nginx has some weighting options for load balancing (see http://wiki.codemongers.com/NginxLoadBalanceExample). Are these just not sophisticated enough for your needs ?