gunicorn性能测试

今天用ab测试工具测试一下gunicorn的性能。

用100的并发量,一共1000个request。都是用Nginx做静态服务器。

 

首先是直接用Django的内置server。

 ab -c 100 -n 1000 http://10.13.27.47

Finished 1000 requests


Server Software:        nginx/1.4.6
Server Hostname:        10.13.27.47
Server Port:            80

Document Path:          /
Document Length:        26021 bytes

Concurrency Level:      100
Time taken for tests:   31.338 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      26347000 bytes
HTML transferred:       26021000 bytes
Requests per second:    31.91 [#/sec] (mean)
Time per request:       3133.795 [ms] (mean)
Time per request:       31.338 [ms] (mean, across all concurrent requests)
Transfer rate:          821.03 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.6      0       8
Processing:   358 2469 3576.6   1675   31329
Waiting:      357 2448 3577.3   1653   31328
Total:        358 2470 3577.3   1675   31337

Percentage of the requests served within a certain time (ms)
  50%   1675
  66%   1774
  75%   1863
  80%   1994
  90%   3064
  95%   7043
  98%  17372
  99%  20252
 100%  31337 (longest request)

在看一下,gunicorn,先采用gevent。

Finished 1000 requests


Server Software:        nginx/1.4.6
Server Hostname:        10.13.27.47
Server Port:            80

Document Path:          /
Document Length:        26021 bytes

Concurrency Level:      100
Time taken for tests:   9.487 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      26347000 bytes
HTML transferred:       26021000 bytes
Requests per second:    105.41 [#/sec] (mean)
Time per request:       948.702 [ms] (mean)
Time per request:       9.487 [ms] (mean, across all concurrent requests)
Transfer rate:          2712.07 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   2.1      0      10
Processing:   102  905 379.9    874    2072
Waiting:      101  905 380.0    874    2071
Total:        102  906 379.7    874    2072

Percentage of the requests served within a certain time (ms)
  50%    874
  66%   1032
  75%   1159
  80%   1251
  90%   1432
  95%   1561
  98%   1743
  99%   1847
 100%   2072 (longest request)

无论是吞吐量,还是连接耗时,gunicorn都是完全优于内置server。现在才测试一下gunicorn别的worker。

 

--------EOF---------
微信分享/微信扫码阅读