I have django apps running on uwsgi, and I found uwsgin can be very CPU
expensive, that's, it usually cost 40% of CPU, or even more 60%- 100%.

My server, the newest dell model,  has 8 core Intel processors and 32G
memory, though I'm not sure the exact model number. The sales guys told me
one of their most powerful models made by Foxxcon.

So I doubt my uwsgi configurations. I'll paste all my configuration soon,
but let me make some explanations.

I don't how many workers I should have, so I started 25 workers on 5
sockets, each handling 5 workers. I also requested them to listen up to
4000 connections, though I don't think I need so many connections, and each
worker will gracefully kills itself before processing 3000 requests.

I'm not sure why I made the configuration, but I did it, seems working
while not busy, but not working while busy. I said not working means I
could found tens of broken pipe each second in the uwsgi log, and the
server load could reach up to 4 or 6.

So any problem with the configuration provided the information above? or
anything else if helpful to analysis.



django.ini configuration:

# specicy workers, please change this according to the server capacity
workers = 25
max-requests = 3000

#set socket listen queue to <n> (default 100, maximum is system dependent)
listen = 4000
socket = :8081
socket = :8082
socket = :8084
socket = :8083
socket = :8085

map-socket = 0:1,2,3,4,5
map-socket = 1:6,7,8,9,10
map-socket = 2:11,12,13,14,15
map-socket = 3:16,17,18,19,20
map-socket = 4:21,22,23,24,25


# load django
module = django.core.handlers.wsgi:WSGIHandler()


# uwsgi log
daemonize = ./log/uwsgi.log
logdate = true
logslow = true
logbig = true
log-5xx = true
disable-logging = true

# use harakiri to kill requests cosing more than 20 seconds
harakiri = 20
# you will be told why killed in detail
harakiri-verbose = true

and finally, thanks.

-- 
*吴焱红(Samuel)*
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to