[uWSGI] Clustering infrastructure

Roberto De Ioris roberto at unbit.it
Fri Nov 26 06:34:14 CET 2010


> This is great!
>
> How would you recommend load balancing & failover to be done in a uWSGI
> cluster? I'm interested in wackamole (http://www.backhand.org/wackamole/)
> which uses virtual IP. Would virtual IP work with uWSGI clustering?
>
> Thanks
> Andy


Normally a uWSGI cluster is behind a http proxy (like nginx or cherokee)
that do the load balancing.

A common setup is (for example) one nginx server that pass requests to N
uwsgi nodes. But the nginx node (in this way) is the bottleneck and SPOF.

So on every uwsgi node a "sleeping" nginx instance should be available that
using virtual IP (via keepalived, carp, or wackamole or some other
ip-takeover system) will eventually came into the game until the main node
will came back.

Another scenario that i am studying, is using the uwsgi proxy on every
webserver node.

You have to configure only a single ip on nginx/cherokee (the ip of the
uwsgi proxy) and the proxy itself will load balance uwsgi connections and
will manage dead and reborn nodes.

I am a lot interested in this second approach as the standard ways to
check if a node is alive are often flaky as (for example) i do not want a
node with 30 load avg or doing swapping to manage requests until it return
to a normal load.

The only problem is that having a second proxy step (nginx - proxy - uwsgi
instead of nginx - uwsgi) will impact performance, but as the uwsgi
protocol parsing is super-fast super-easy it should be irrilevant.


So the setup i am working on is:

node1:
nginx/cherokee listening on public ip
uwsgi proxy listening on 127.0.0.1
an ip takeover technology (like wackamole)

node2:
the same as node 1

So node1 and node2 are the "outers" node.

Then a pool (even hundreds) of uwsgi servers that announce their
availability and load status to the two uwsgi proxies.

There are obviously a lot of more scenario but my objective is to cut-off
the maintainance cost of having to edit hundreds of config files avery
time we add or remove) a node


-- 
Roberto De Ioris
http://unbit.it


More information about the uWSGI mailing list