HTTP load balancer with support for dynamic backend membership

apache-2.2load balancingPROXY

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?

Best Answer

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