使用 Apache 的 ab 工具测试了下几个网站的并发

本机配置

本地测试 echo ‘hello world’

./ab -c10 -n1000 http://localhost/helloworld.php
Server Software:        nginx/1.11.5
Server Hostname:        wp.a.cc
Server Port:            80

Document Path:          /helloworld.php
Document Length:        25 bytes

Concurrency Level:      10
Time taken for tests:   1.041 seconds
Complete requests:      1000
Failed requests:        12
   (Connect: 0, Receive: 0, Length: 12, Exceptions: 0)
Non-2xx responses:      1000
Total transferred:      219284 bytes
HTML transferred:       26776 bytes
Requests per second:    960.29 [#/sec] (mean)
Time per request:       10.414 [ms] (mean)
Time per request:       1.041 [ms] (mean, across all concurrent requests)
Transfer rate:          205.64 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:     2   10   4.7      9      22
Waiting:        2   10   4.6      8      22
Total:          3   10   4.7      9      22

测试 phpinfo()

./ab -c10 -n1000 http://localhost/phpinfo.php
Server Software:        nginx/1.11.5
Server Hostname:        wp.a.cc
Server Port:            80

Document Path:          /phpinfo.php
Document Length:        98215 bytes

Concurrency Level:      10
Time taken for tests:   4.408 seconds
Complete requests:      1000
Failed requests:        107
   (Connect: 0, Receive: 0, Length: 107, Exceptions: 0)
Non-2xx responses:      17
Total transferred:      96733608 bytes
HTML transferred:       96548186 bytes
Requests per second:    226.85 [#/sec] (mean)
Time per request:       44.083 [ms] (mean)
Time per request:       4.408 [ms] (mean, across all concurrent requests)
Transfer rate:          21429.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:    10   44   8.9     43      78
Waiting:        9   43   8.9     42      78
Total:         10   44   8.9     43      78

测试新装 WordPress

./ab -c10 -n100 http://localhost/wordpress/
Server Software:        nginx/1.11.5
Server Hostname:        wp.a.cc
Server Port:            80

Document Path:          /wordpress/
Document Length:        52976 bytes

Concurrency Level:      10
Time taken for tests:   45.738 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      5323100 bytes
HTML transferred:       5297600 bytes
Requests per second:    2.19 [#/sec] (mean)
Time per request:       4573.759 [ms] (mean)
Time per request:       457.376 [ms] (mean, across all concurrent requests)
Transfer rate:          113.66 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       1
Processing:   447 4366 790.2   4507    5239
Waiting:      446 4366 790.2   4507    5239
Total:        447 4367 790.2   4507    5240

WordPress 安装 WP Super Cache 缓存插件

./ab -c10 -n100 http://localhost/wordpress/
Server Software:        nginx/1.11.5
Server Hostname:        wp.a.cc
Server Port:            80

Document Path:          /wordpress/
Document Length:        53120 bytes

Concurrency Level:      10
Time taken for tests:   2.721 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      5338000 bytes
HTML transferred:       5312000 bytes
Requests per second:    36.75 [#/sec] (mean)
Time per request:       272.131 [ms] (mean)
Time per request:       27.213 [ms] (mean, across all concurrent requests)
Transfer rate:          1915.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:    32  260  47.2    268     328
Waiting:       32  260  47.2    268     328
Total:         32  261  47.2    269     328

发表评论

电子邮件地址不会被公开。 必填项已用*标注