I have the gut feeling this has to do with all of the 128 worker processes 
waking up, then going back to sleep, for every request but only one lucky one 
of them manages to nab the request for processing.
See Roberto's extensive explanation about the thundering herd problem in the 
docs: 
http://uwsgi-docs.readthedocs.org/en/latest/articles/SerializingAccept.html
In addition, if you look at uwsgitop / the stats server output, you'll probably 
find out that the requests aren't served equally by all the workers.
You might want to look at Cheaper mode to spawn new workers only when needed 
instead of having 128 workers milling around doing not much at all: 
http://uwsgi-docs.readthedocs.org/en/latest/Cheaper.html


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Dmitry Sivachenko
Sent: Wednesday, August 21, 2013 5:26 PM
To: [email protected]
Subject: [uWSGI] Strange behavior with 'processes' number

Hello!

I am using uwsgi-1.9.10 on FreeBSD.

My uwsgi.ini is the following:
[uwsgi]
buffer-size = 65535
carbon = w.x.y.z:2003
carbon-id = xxx
carbon-no-workers = true
chdir = /var/chroot/uwsgi
enable-threads = true
harakiri = 10
harakiri-verbose = true
listen = 1024
master = true
max-requests = 10000
module = frontend.wsgi
no-orphans = true
processes = 32
vacuum = true

uwsgi is running on 16-core CPU machine and usual LA is ~3.
These 32 processes is enough to process all the incoming requests (more that 
enough actually).

Now I bump 'processes' parameter to, say, 128.  The incoming request rate does 
not change, so I assume that
these 128 workers will process request as 32 processes did, just each worker 
will receive 4 times less requests and will sleep more waiting for next request.

But what I see is that LA on that machine raise to 30 (up from 3), and CPU time 
raise from ~15%user+5%system to
40% user + 30% system.

Why??

In similar scenario when running Apache in pre-fork mode it does not matter how 
much MinSpareServers I have (1 or 100),
CPU time is utilized equally.  Why is it not the case with uwsgi?


Thanks in advance.
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

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

Reply via email to