/ 中存储网

使用ab命令对Apache,Nginx,Nginx proxy读取静态文件测试

2013-12-20 18:35:01 来源:kejihao
文章作者:Enjoy 转载请注明原文链接。 今天抽空分别在三个http下(apache,nginx,nginx proxy)用ab测试一下读取静态文件的反应时间。

ab.exe -c 10 -n 100 http://www.server110.com/

Document Path:          /css/hx.css

Document Length:        215 bytes

Concurrency Level:      10

Complete requests:      100

Failed requests:        0

Write errors:           0

Non-2xx responses:      100

Total transferred:      38300 bytes

HTML transferred:       21500 bytes

apache

Time taken for tests:   5.297 seconds

min  mean[+/-sd] median   max

Connect:       16   52 296.3     16    2984

Processing:    16  462 915.0    203    4047

Waiting:       16  246 688.7    109    4047

Total:         47  514 951.7    219    4063

nginx

Time taken for tests:   4.859 seconds

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       16   48 295.1     16    2969

Processing:    16  427 897.8    156    4359

Waiting:       16  191 599.0     94    4359

Total:         47  475 936.5    172    4375

nginx proxy

Time taken for tests:   4.219 seconds

min  mean[+/-sd] median   max

Connect:       16   18   5.8     16      31

Processing:    31  184 289.0    156    3031

Waiting:       16  123 297.2     94    3031

Total:         47  202 288.8    188    3047

这个文件比较小,在来个稍大一点的测试JQuery v1.3.2

ab.exe -c 10 -n 50 http://www.server110.com/

Document Path:          /js/jquery.js

Document Length:        57254 bytes

Concurrency Level:      10

Complete requests:      50

Failed requests:        0

Write errors:           0

Total transferred:      2880700 bytes

HTML transferred:       2862700 bytes

apache

Time taken for tests:   34.688 seconds

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       16   22   7.7     16      31

Processing:   438 4861 7810.7   1313   31031

Waiting:       16  827 3082.5     31   21078

Total:        469 4883 7811.5   1328   31047

nginx

Time taken for tests:   29.875 seconds

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       16   20   7.1     16      31

Processing:   438 4940 6601.4   1703   23484

Waiting:       16  574 1563.6     16    9016

Total:        453 4960 6601.6   1734   23516

nginx proxy

Time taken for tests:   28.484 seconds

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       16   19   6.7     16      31

Processing:   406 4532 6301.3   1875   28375

Waiting:       16 1234 4325.4     31   21031

Total:        422 4552 6301.6   1891   28391

测试结果,读取静态文件,nginx_proxy最快,nginx比apache略快一点点。

测试可能受网络和负荷的影响,但基本上是这个结果。