« Paper: Consensus Protocols: Two-Phase Commit | Main | Beta testers wanted for ultra high-scalability/performance clustered object storage system designed for web content delivery »
Thursday
Feb052009

Product: HAProxy - The Reliable, High Performance TCP/HTTP Load Balancer

Update: Load Balancing in Amazon EC2 with HAProxy. Grig Gheorghiu writes a nice post on HAProxy functionality and configuration: Emulating virtual servers, Logging, SSL, Load balancing algorithms, Session persistence with cookies, Server health checks, etc.

Adapted From the website:

HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with todays hardware. Its mode of operation makes its integration into existing architectures very easy and riskless, while still offering the possibility not to expose fragile web servers to the Net.

Currently, two major versions are supported :
* version 1.1 - maintains critical sites online since 200 The most stable and reliable, has reached years of uptime. Receives no new feature, dedicated to mission-critical usages only.
* version 1.2 - opening the way to very high traffic sites

The same as 1.1 with some new features such as poll/epoll support for very large number of sessions, IPv6 on the client side, application cookies, hot-reconfiguration, advanced dynamic load regulation, TCP keepalive, source hash, weighted load balancing, rbtree-based scheduler, and a nice Web status page. This code is still evolving but has significantly stabilized since 1.2.8.

Unlike other free "cheap" load-balancing solutions, this product is only used by a few hundreds of people around the world, but those people run very big sites serving several millions hits and between several tens of gigabytes to several terabytes per day to hundreds of thousands of clients. They need 24x7 availability and have internal skills to risk to maintain a free software solution. Often, the solution is deployed for internal uses and I only know about it when they send me some positive feedback or when they ask for a missing feature ;-)


According to many users HAProxy competes quite well with the likes of Pound and Ultramonkey.

Reader Comments (13)

Hi, i red the source code of this project and i think it's the clear example how not written a project.

December 31, 1999 | Unregistered Commenterundol

FWIW, I used HAProxy for a previous project, and was immensely impressed. I wish the project's author did a better job of fostering a community around the project, but I can't argue with the results. We switched from pound. Pound generally worked well, but was more resource hungry (chiefly CPU), and also had the occasional bug.

December 31, 1999 | Unregistered CommenterDC

I can't understand why people are so fond of Pound. Yes it works and yes it is just a tad easier to config compared to HAProxy.

I use (and have used for more than a year) HAProxy on a number of Rails installations. I have it configured to have the backend mongrels only handle 1 request at a time, so requests always get send to the first available mongrel instead of queueing up at mongrel level. It's also configured to check if the mongrels are alive by requesting a very light, no db action.
This way, if a mongrel hangs without crashing (otherwise it would get restarted) haproxy stops sending requests to that mongrel.

HAProxy is also very light on resources and very stable. So far it hasn't crashed on me once.

Check it out!

December 31, 1999 | Unregistered CommenterPiet Hadermann

If you dont want to get your hands dirty and need HAproxy, LVS, and pound for ssl termination + failover and support and hardware included, look at http://www.loadbalancer.org.

No I dont work for them or resell their products. I am just a happy customer.

December 31, 1999 | Unregistered Commenteratif.ghaffar

We will be soon testing it's performance, but so far it looks very interesting. I hope 1.3 version comes out soon.

December 31, 1999 | Unregistered CommenterApache guy

haproxy is great. we run it on 2 very weak machines and let it direct traffic to our multiple web servers. not a single problem.

December 31, 1999 | Unregistered CommenterAnonymous

HAproxy is far the fastest free LB I know.

Author - Willy Tarreau - is open and brilliant.

We had some scalability issues, but after few tips from W.T. we were able to saturate 0.5 Gb (64MB/s) with 2-4000 r/s with 40% CPU usage on Pentium D (one core) in real production (eh. high response times on urls).

The key to success is good network device and driver (http://haproxy.1wt.eu/10g.html) and good knowledge of system (and author is really open to help you).

You should definitely try that solution before going for BIG IP(F5) or Crescendo.

December 31, 1999 | Unregistered Commenterpulczynski

Another very happy HAProxy user here. Wrote a quick how-to for load balancing and QoS with HAProxy:
http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/

ig

December 31, 1999 | Unregistered CommenterIlya Grigorik

Have been using HAProxy for years on http://www.mammothmountain.com for a rather complex/diverse cluster setup. It can handle 1mil to 10mil hits daily without even making a dent on cpu/mem on the machine. Completely dependable. Moved from an LVS setup of several years to HAProxy for ease of setup/config/maint as all we really needed was reverse proxy capabilities.

Had great success using HAProxy for a large cluster in the Amazon EC2 environment.

December 31, 1999 | Unregistered Commenternum

Hi

I am trying to set up a Haproxy/Apache front end, serving requests to a number of Apache back end servers. The goal is to have Haproxy handle all http requests and since Haproxy can't handle SSL I want Apache to handle the SSL and pass them along to Haproxy. Then Haproxy should do all the reverse proxying for the rest of the back end Apache servers.

So far I have only been able to set this up successfully for http requests handles by Haproxy but unsuccessful in getting this to work with Apache.

Has anyone done this successfully? If yes can you provide examples of the Apache and Haproxy config please?

December 31, 1999 | Unregistered CommenterGeorge

Instead of using Apache I deploy stunnel in front of HAPRoxy and have it handle the SSL traffic. The resulting configuration has been VERY fast and we haven't seen it hiccup yet.

I'm in the middle of writing up exactly how I set up my implementation, and would be happy to pass along my notes if you're interested.

December 31, 1999 | Unregistered CommenterJoe

I would love to get your notes on your stunnel implememtation if possible.
Thanks!

December 31, 1999 | Unregistered CommenterAnonymous

Could you please share you experience with setting stunnel with Haproxy?
Thank you in advance.

December 31, 1999 | Unregistered CommenterAnonymous

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>