I'm running a django site with nginx through uwsgi. The problem is uwsgi process take a lot of CPU time when traffic become heavy. The same configuration works fine on test server and siege/ab simulate heavy concurrent traffic.

Here is one strace log of uwsgi process. http://dl.dropbox.com/u/43017476/strace.log

And some sysctl:

fs.file-max = 128000
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.netdev_max_backlog = 4096
net.ipv4.tcp_max_syn_backlog = 4096
net.core.somaxconn = 250000
net.ipv4.tcp_keepalive_time = 300

nginx conf is pretty same as other tutorials from Google. I have been trying to figure it out but no luck. However I found a lot of this pieces:

22:12:02.932276 read(8, "\7\0\0\2\0\0\0\2\0\0\0", 16384) = 11
22:12:02.932504 poll([{fd=8, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
22:12:02.932547 write(8, "\17\0\0\0\3SET NAMES utf8", 19) = 19
22:12:02.932643 read(8, "\7\0\0\1\0\0\0\2\0\0\0", 16384) = 11
22:12:02.933237 poll([{fd=8, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
22:12:02.933279 write(8, "\21\0\0\0\3set autocommit=0", 21) = 21
22:12:02.933330 read(8, "\7\0\0\1\0\0\0\0\0\0\0", 16384) = 11

Whereas file descriptor 8 is a mysql socket. But Mysql server seems working pretty fine. I can see each "read" system call consumes most CPU time but don't know what's going wrong here. The same database server has been serving former PHP site without problem.

Any ideas appreciated.

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.