我使用基于Ubuntu Server 12.04.4 LTS的VirtulBox创建了两个虚拟机,一个使用APACHE-MYSQL,另一个使用NGINX-MYSQL。已安装的版本是从标准存储库中获取的版本。现在我想使用AB测试一个本地站点(在两台机器上相同)。我注意到有关完成操作的总时间的结果非常不同。所以这些是我的结果:
APACHE-MYSQL:
ab -n 100 -c 10 http://www.myrestsite.com/device/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.myrestsite.com (be patient).....done
Server Software: Apache/2.2.22
Server Hostname: www.myrestsite.com
Server Port: 80
Document Path: /device/
Document Length: 220 bytes
Concurrency Level: 10
Time taken for tests: 50.285 seconds
Complete requests: 100
Failed requests: 17
(Connect: 0, Receive: 0, Length: 17, Exceptions: 0)
Write errors: 0
Total transferred: 39801 bytes
HTML transferred: 22001 bytes
Requests per second: 1.99 [#/sec] (mean)
Time per request: 5028.547 [ms] (mean)
Time per request: 502.855 [ms] (mean, across all concurrent requests)
Transfer rate: 0.77 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 2.3 0 9
Processing: 5008 5023 25.6 5014 5127
Waiting: 4 17 25.3 8 121
Total: 5008 5024 26.3 5014 5128
Percentage of the requests served within a certain time (ms)
50% 5014
66% 5017
75% 5021
80% 5025
90% 5060
95% 5091
98% 5127
99% 5128
100% 5128 (longest request)
NGINX-MYSQL:
ab -n 100 -c 10 http://www.myrestsite.com/device/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.myrestsite.com (be patient).....done
Server Software: nginx/1.1.19
Server Hostname: www.myrestsite.com
Server Port: 80
Document Path: /device/
Document Length: 221 bytes
Concurrency Level: 10
Time taken for tests: 0.579 seconds
Complete requests: 100
Failed requests: 90
(Connect: 0, Receive: 0, Length: 90, Exceptions: 0)
Write errors: 0
Total transferred: 38598 bytes
HTML transferred: 21998 bytes
Requests per second: 172.75 [#/sec] (mean)
Time per request: 57.887 [ms] (mean)
Time per request: 5.789 [ms] (mean, across all concurrent requests)
Transfer rate: 65.11 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 2
Processing: 17 56 87.0 27 333
Waiting: 17 56 86.9 27 333
Total: 17 57 87.3 27 334
Percentage of the requests served within a certain time (ms)
50% 27
66% 30
75% 34
80% 39
90% 271
95% 322
98% 331
99% 334
100% 334 (longest request)
相同的请求在APACHE上需要50.285秒,在NGINX上需要0.579秒这是正常的吗?他们之间可能有这样的区别吗?谢谢。