Dynamic Upstream Provider List

I am working on a load balancing system where the upstream providers
need to change at runtime. The available peer group will be routed
either by a hash, or by round robin, but the size of the peer group
might change between any request.

The easy way seems to be to bypass the upstream http functionality
altogether and simply return the appropriate peer from the callback in
r->upstream->peer.get

Will this work?
Does something else already do this?
If not, what is a more idiomatic way to write this module?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,92715,92715#msg-92715

I do this by overwriting a conf included file and gracefully restarting,
how often are you expecting this to change?

Hi,

I am working on a load balancing system where the upstream providers need
to change at runtime. The available peer group will be routed either by a
hash, or by round robin, but the size of the peer group might change
between any request.

Do you really need this list to be dynamic? Maybe static list of
backends
that are dynamically marked as either “up” or “down” is good enough? If
so,
please take a look at ngx_supervisord [1] (you will probably want to use
it
with “supervisord none;” setting). You can also use it together with
health-check module to automatically mark failed backends as “down”.

[1] http://labs.frickle.com/nginx_ngx_supervisord/
[2] http://github.com/cep21/healthcheck_nginx_upstreams

Best regards,
Piotr S. < [email protected] >

The list will be very dynamic, as in new, previous unknown items should
be able to be added at runtime. I’ll thank you both for your suggestions
and will investigate them. Supervisord looks neat for a number of
reasons outside of the scope of this :slight_smile:

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,92715,92949#msg-92949