Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to deploy a reverse proxy/HTTP load balancer in front of a number of backend application servers. The hitch is that the set of backends may change over time, and new application servers may be created dynamically (so the total set cannot be known in advance). This means something like Varnish, which can perform health checks against a known set of backends, isn't an option.

The best I've been able to come up with is the prg RewriteMap support in Apache combined with proxy RewriteRule expressions. I've hacked together a simple client/server mechanism for the application servers to "register" themselves with the frontend, and a RewriteMap program that selects backends from this list. It works, but it smells really hacky.

This seems like it must be a reasonably common scenario (with so many cloud service providers out there that make it easy to spin up new servers on demand). How are other people solving this problem? Are you just using a commercial load balancer? Are is everyone throwing together something on their own?

share|improve this question
add comment

3 Answers

Apache's built-in (well, supplied) mod_proxy_balancer module provides most of this functionality, including individual weighting and controlled merge-in and drop-out of member backends.

There is also a balancer-manager app to visualize and control this behaviour at runtime.

See here for the details: http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

share|improve this answer
    
Ah, I hadn't noticed the managed functionality of that module. I'll take a look. –  larsks Aug 24 '12 at 13:40
add comment

nginx doesn't support this out of the box but this is pretty easy to implement. I did it so below explained in detail

1) creat separate config file just for upstreams (upstreams.conf) and include them from main nginx.conf 2) now you can edit this file by hand or script separately, I wrote a simple perl script to manage this file add/delete text lines with upstream description. 3) send HUP signal to main nginx process to issue graceful reload 4) Some web UI has been implemented to control these operations and provide health checks but it is not FOSS

Dispute that there are a couple of 3-the side modules which implement health check and management interface please take a look at

http://wiki.nginx.org/HttpHealthcheckModule https://bitbucket.org/benjaminws/nginxmgr/ https://github.com/FRiCKLE/ngx_supervisord

I am not sure but may be haproxy has ame functionality also.

share|improve this answer
add comment

Almost all of the commercial load balancing solutions (F5, Citrix, A10, etc) have configuration management APIs (REST or SOAP based) which could be easily leveraged for this purpose - servers can add themselves to the relevant pools as part of their startup routing, and delete themselves when they shut down. If a server crashes, the LB would mark it down due to healthcheck failures.

share|improve this answer
add comment

Your Answer

 
discard

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.