Ask HN: What load balancing software do you use ?
- Nginx (http://nginx.net/) - Pound (http://www.apsis.ch/pound/) - HAProxy (http://haproxy.1wt.eu/) - Perlbal (http://www.danga.com/perlbal/)
Does anybody have experience using any of these, in live production environments (under reasonably heavy usage), and if so what pros and cons do you see with them ?
[+] [-] anotherjesse|18 years ago|reply
[internet] <-> [Nginx] <-> [HAProxy] <-> [app servers]
Nginx is a great webserver, but isn't a good load balancer. You can install a patch that improves the balancer - http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer... - but it still isn't as nice as HAProxy
With HAProxy the status of the system is visible. For the largest site I use HAProxy on I keep my status page public - http://userscripts.org/haproxy - but it isn't required.
HAProxy is particularly good for rails since you can say each app server can only have 1 request at any time. This makes requests queue at the HAProxy layer, so if an app server has a request that takes a extra long time you don't have requests waiting for that app server to finish - instead you wait for the next available app server in a FIFO queue.
Combining HAProxy with munin gives great stats for tuning your system - whereas just nginx with the patch had no visibility into where bottlenecks might be.
I
[+] [-] whyleyc|18 years ago|reply
- 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 ?
[+] [-] jbyers|18 years ago|reply
One question that will help decide how things are structured is SSL. If you need it, putting haproxy up front gives you a bit of trouble -- haproxy doesn't support SSL (though it will blindly forward SSL at layer 4 if you want). So you'd need stunnel, nginx, Apache, or something else up front to decode.
[+] [-] photomatt|18 years ago|reply
http://barry.wordpress.com/2008/04/28/load-balancer-update/
I wouldn't recommend DNS round robin for load balancing. (We did it for a while, many problems and flaws in the approach.)
[+] [-] whatusername|18 years ago|reply
[+] [-] samueladam|18 years ago|reply
http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-b...
[+] [-] thingsilearned|18 years ago|reply
http://leavingcorporate.com/2008/03/03/session-based-load-ba...
[+] [-] brianr|18 years ago|reply
Both have worked pretty well so far. As anortherjesse said, there's not a lot of feedback, but it's done everything I need so far.
[+] [-] DenisM|18 years ago|reply
[+] [-] crescendo|18 years ago|reply
[+] [-] jbyers|18 years ago|reply
If you do go the multiple A record route, do so in combination with one of the load balancers you asked about, and ideally with IP failover. But probably this is a lot more complexity than you want.
[+] [-] jamess|18 years ago|reply
[+] [-] SwellJoe|18 years ago|reply
PerlBal looks really cool, as being written in Perl means it has some of the same kinds of flexibility that Squid has (a good reason for Squid is that you can write your own balancing algorithm in any language you like in a redirector script--I always used Perl, or Python when I was working with the Zope guys--so, you can actually do crazy stuff like choose the right server based on keeping them "primed" for the content users are asking for based on URL, or you can use destination URL hashing and achieve the same effect even if you have millions of URLs). Squid also has experimental support for ESI (Edge Side Includes) which is pretty awesome...build a page from disparate and wholly unrelated servers using a simple templating system, and caching them. I don't think any other Open Source product out there has ESI (experimental or otherwise).
[+] [-] drusenko|18 years ago|reply
[+] [-] rcoder|18 years ago|reply
It's probably not as fast as Nginx, but I haven't found our load balancers to be a bottleneck. In fact, we've been doing load balancing on a pair of really, really wimpy servers (Celeron CPU and 512MB of RAM) running Apache on OpenBSD for about a half-dozen different apps for the last year, and never seen the average load climb up over about 0.5, even while handling upwards of 300 requests per second.
[+] [-] blader|18 years ago|reply
[+] [-] swombat|18 years ago|reply
Works great.
Daniel
[+] [-] anotherjesse|18 years ago|reply
[+] [-] holygoat|18 years ago|reply
However, I recently noticed a memory leak. We use healthchecks on our production machines, which means a consistent rate of hits every few seconds, 24/7. After about 3 months, Pound had chewed up 1.7GB of RAM, which caused memory usage alerts in our monitors.
Not a big deal -- you can always restart the process -- but I'm still evaluating alternatives.
[+] [-] jrockway|18 years ago|reply
For our $WORK applications, we just have an apache that proxies to the backend FastCGI apps. We don't have a ton of load, so that works fine. (We might be switching to nginx, which is much simpler than Apache for this use case.)
[+] [-] subwindow|18 years ago|reply
I definitely prefer Nginx. It seems much faster, and has definitely given fewer headaches. It seems like an issue with Pound crops up every few weeks. My Pound config file is about 600 lines long now, and it is starting to get unmaintainable.
[+] [-] mattculbreth|18 years ago|reply
[+] [-] azsromej|18 years ago|reply
[+] [-] andy|18 years ago|reply
[+] [-] modoc|18 years ago|reply
We used HAProxy and Heartbeat2 to provide fully redundant load balancers. On our smaller sites, we actually run the HAProxy and Heartbeat2 on two of the web servers for that cluster, so you don't need dedicated hardware if you don't want it. If you do this, and you're on softlayer, I'd recommend sending the back-channel traffic along the internal network to avoid using 2X your real bandwidth.
You can read about how to set it up here:
http://www.digitalsanctuary.com/tech-blog/debian/13-steps-to...
[+] [-] merrick33|18 years ago|reply
It was very smooth to setup with debian, but my first experience setting it up was with redhat and that was tortuous
[+] [-] jdavid|18 years ago|reply
[+] [-] jawngee|18 years ago|reply
[+] [-] ubudesign|18 years ago|reply
[+] [-] whyleyc|18 years ago|reply
[+] [-] wensing|18 years ago|reply