Hi,

I'm doing some stress test of uWSGI with 3 servers:

nginx -> uwsgi fastrouter -> 2x uwsgi backend
(nginx and fastrouter are on same server)

and one backend gets 2x more requests. I've tested it with apache benchmark 
using:

ab -n 10000 -c 1 -H "Host: app.domain.com" "http://$nginx_address/$some_url";

- c 1 was used so that it's not casued by one backend responding faster then 
the other, requests are issued one after one so if fastrouter uses round robin 
to load balance, both backend should get equal number of requests but it does 
not. So how does fastrouter dispatch request by default? 
http://projects.unbit.it/uwsgi/wiki/FastRouter shows that one can write custom 
code for load balancing but all I want right now is simple rr over all 
subscribed vassals, how can I achieve that?

results:
172.16.200.55: 6667 requests
172.16.200.56: 3333 requests

second run, this time I've reloaded vassal on first node just after starting 
ab:
172.16.200.55:  3303 requests
172.16.200.56:  6679 requests
so now second node got twice as much requests.
It seems that by default fastrouter will prefer first working node (?).

log from fastrouter startup:
[2011-11-29 09:52:28.789360] [('172.16.200.53', 55923)] received message: 
[uwsgi-subscription] new pool: app.domain.com
[2011-11-29 09:52:28.789494] [('172.16.200.53', 55923)] received message: 
[uwsgi-subscription] app.domain.com => new node: 172.16.200.56:3001
[2011-11-29 09:52:29.721830] [('172.16.200.53', 55923)] received message: 
[uwsgi-subscription] app.domain.com => new node: 172.16.200.55:3001

adding stats option to fastrouter instance doesn't give any fastrouter 
statistics but looking at the cpu usage on backends during the ab run, shows 
that one node constantly gets twice the load, and requests log confirms it:

(ip,source port)
'172.16.200.56',33894
'172.16.200.56',33894
'172.16.200.55',55817
'172.16.200.56',33894
'172.16.200.56',33894
'172.16.200.55',55817
'172.16.200.56',33894
'172.16.200.56',33894
'172.16.200.55',55817
'172.16.200.56',33894
'172.16.200.56',33894
'172.16.200.55',55817

Łukasz Mierzwa
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to