Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is more of a 'best practice' or 'input appreciated' question.

Currently we manage about 5 webservers (in two DC's) that run Nginx for PHP websites. The plan is to redesign the setup so it is more manageable from an administrative point of view. One server is in a DC in another network, the rest in a single rack.

We sometimes have to move clients website(s) from one server to another and we would like to allow redundancy for certain clients etc. So a proxy seems a good start and any speed increase is highly welcomed, HAProxy seems like a good candidate for this both.

Our idea at this point is to make a single machine the HAProxy to everything else, so we can redirect anything anywhere, Seems smart to make that machine failover with something like CARP.

Any insights / input are highly appreciated.

share|improve this question
up vote 1 down vote accepted

I've setup a system like this in the past; for those who can't afford a full blown second datacenter & highend intelligent switching for failover, its not a bad option.

There's one significant disadvantage to this, and thats if your paying for your bandwidth wherever the haproxy is hosted, you'll be paying double for bandwidth for connections that are proxied.

Otherwise its a reasonable solution for those wanting to have loadbalancing or even just active failover.

Another pretty popular loadbalancer/webserver/proxy is nginx, which might be worth looking at as well.

share|improve this answer
Thanks! Regarding the bandwidth; a proxied request would serve (within the proxied data TTL that is) directly from the HAProxy machine without calling the actual serving machine, wouldn't it? So bandwidth only doubles upon a cache refresh request? – Matt Jun 28 '10 at 11:21
Depends on your setup. I haven't used Haproxy as a caching server, however logically you would be correct. – GruffTech Jun 28 '10 at 14:53
Mmhm. Looking into it I don't think HAProxy is up to the caching task, so that would mean either an extra layer behind HAProxy or a dedicated layer in front of it... which would in return need redundancy as well. – Matt Jun 29 '10 at 13:52
Both Apache with Mod_Proxy and Mod_Cache, as well as NginX with Ncache (i think ncache is built into nginx now) should do the trick for both proxy and cache. From my experience both are faster then Ha_Proxy in terms of requests/second, and only apache has real disadvantages. nginx is a bit of a learning curve if you've not messed with it before, but its a beast of a server/proxy/cache once its implemented. – GruffTech Jun 29 '10 at 14:59
Thanks GruffTech; I started looking into HAProxy because of… The ncache is now in nginx core, and there is also fastcgi_cache now. I have not used them for actual caching but will try! – Matt Jun 29 '10 at 15:35

you should be able to use internal ip addresses to talk from LB to the backends nodes.. and internal network traffic would cost 0.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.