小编che*_*xee的帖子

分析uwsgi strace日志,找出CPU占用率高的原因

我正在通过 uwsgi 使用 nginx 运行 django 站点。问题是当流量变大时,uwsgi 进程会占用大量 CPU 时间。相同的配置在测试服务器上运行良好,并且 siege/ab 模拟大量并发流量。

这是 uwsgi 进程的一份 strace 日志。http://dl.dropbox.com/u/43017476/strace.log

还有一些 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
Run Code Online (Sandbox Code Playgroud)

nginx conf 与 Google 的其他教程非常相似。我一直在试图弄清楚但没有运气。不过我发现了很多这样的作品:

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, …
Run Code Online (Sandbox Code Playgroud)

mysql ubuntu nginx django uwsgi

5
推荐指数
1
解决办法
3066
查看次数

标签 统计

django ×1

mysql ×1

nginx ×1

ubuntu ×1

uwsgi ×1