uwsgi长时间超时

时间:2013-03-21 10:56:15

标签: sockets timeout uwsgi

我正在使用ubuntu 12,nginx,uwsgi 1.9 with socket,django 1.5。

配置:

[uwsgi]
base_path = /home/someuser/web/
module = server.manage_uwsgi
uid = www-data
gid = www-data
virtualenv = /home/someuser
master = true
vacuum = true
harakiri = 20
harakiri-verbose = true
log-x-forwarded-for = true
profiler = true
no-orphans = true
max-requests = 10000
cpu-affinity = 1
workers = 4
reload-on-as = 512
listen = 3000

Windows7的客户端测试:

C:\Users\user>C:\AppServ\Apache2.2\bin\ab.exe -c 255 -n 5000 http://www.someweb.com/about/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.someweb.com (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Finished 5000 requests


Server Software:        nginx
Server Hostname:        www.someweb.com
Server Port:            80

Document Path:          /about/
Document Length:        1881 bytes

Concurrency Level:      255
Time taken for tests:   66.669814 seconds
Complete requests:      5000
Failed requests:        1
   (Connect: 1, Length: 0, Exceptions: 0)
Write errors:           0
Total transferred:      10285000 bytes
HTML transferred:       9405000 bytes
Requests per second:    75.00 [#/sec] (mean)
Time per request:       3400.161 [ms] (mean)
Time per request:       13.334 [ms] (mean, across all concurrent requests)
Transfer rate:          150.64 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    8 207.8      1    9007
Processing:    10 3380 11480.5    440   54421
Waiting:        6 1060 3396.5    271   48424
Total:         11 3389 11498.5    441   54423

Percentage of the requests served within a certain time (ms)
  50%    441
  66%    466
  75%    499
  80%    519
  90%   3415
  95%  36440
  98%  54407
  99%  54413
 100%  54423 (longest request)

我也设置了以下选项:

echo 3000 > /proc/sys/net/core/netdev_max_backlog
echo 3000 > /proc/sys/net/core/somaxconn

所以,

1)我超快速地发出3000个请求。我看到ab和uwsgi请求日志中的进展 -

[pid: 5056|app: 0|req: 518/4997] 80.114.157.139 () {30 vars in 378 bytes} [Thu Mar 21 12:37:31 2013] GET /about/ => generated 1881 bytes in 4 msecs (HTTP/1.0 200) 3 headers in 105 bytes (1 switches on core 0)
[pid: 5052|app: 0|req: 512/4998] 80.114.157.139 () {30 vars in 378 bytes} [Thu Mar 21 12:37:31 2013] GET /about/ => generated 1881 bytes in 4 msecs (HTTP/1.0 200) 3 headers in 105 bytes (1 switches on core 0)
[pid: 5054|app: 0|req: 353/4999] 80.114.157.139 () {30 vars in 378 bytes} [Thu Mar 21 12:37:31 2013] GET /about/ => generated 1881 bytes in 4 msecs (HTTP/1.0 200) 3 headers in 105 bytes (1 switches on core 0)

我没有任何破损的管道或工人重生。

2)下一个请求运行速度很慢或有一些超时。看起来有些缓冲区已满,我在它变空之前等待。

3)某些缓冲区变空。

4)超快速处理~500个请求。

5)有些超时。

6)见Nr。 4

7)见Nr。 5

8)见Nr。 4

9)见Nr。 5

...

...

需要你的帮助

1 个答案:

答案 0 :(得分:0)

检查netstat和dmesg。你可能已经耗尽了短暂的端口或填满了conntrack表。