测试环境
硬件环境(虚拟机):
4核 1G
运行环境:
Nginx 8 进程 ,
PHP-FPM 静态模式 8进程,
MixHttpd 8进程,
框架 | 环境 |
---|---|
Yii | Nginx + PHP-FPM |
CodeIgniter | Nginx + PHP-FPM |
MixPHP | Nginx + PHP-FPM |
Phalcon | Nginx + PHP-FPM |
MixPHP | Nginx + MixHttpd |
测试工具
使用 ab 工具压测,命令:ab -c 300 -n 3000 URL
测试详情
1. Yii (已关闭debug)
Nginx + PHP-FPM
C:\Server\apache24vc11\bin>ab -c 300 -n 3000 http://www.t1.com/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.t1.com (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.13.6
Server Hostname: www.t1.com
Server Port: 80
Document Path: /
Document Length: 9 bytes
Concurrency Level: 300
Time taken for tests: 32.282 seconds
Complete requests: 3000
Failed requests: 18
(Connect: 0, Receive: 0, Length: 18, Exceptions: 0)
Non-2xx responses: 18
Total transferred: 518754 bytes
HTML transferred: 29952 bytes
Requests per second: 92.93 [#/sec] (mean)
Time per request: 3228.181 [ms] (mean)
Time per request: 10.761 [ms] (mean, across all concurrent requests)
Transfer rate: 15.69 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.0 1 34
Processing: 194 2139 5414.6 751 31344
Waiting: 157 2139 5414.7 750 31343
Total: 197 2140 5414.6 751 31344
Percentage of the requests served within a certain time (ms)
50% 751
66% 835
75% 915
80% 923
90% 1746
95% 9868
98% 31109
99% 31235
100% 31344 (longest request)
2. CodeIgniter
Nginx + PHP-FPM
C:\Server\apache24vc11\bin>ab -c 300 -n 3000 http://www.t2.com/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.t2.com (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.13.6
Server Hostname: www.t2.com
Server Port: 80
Document Path: /
Document Length: 8 bytes
Concurrency Level: 300
Time taken for tests: 21.911 seconds
Complete requests: 3000
Failed requests: 16
(Connect: 0, Receive: 0, Length: 16, Exceptions: 0)
Non-2xx responses: 16
Total transferred: 515464 bytes
HTML transferred: 26640 bytes
Requests per second: 136.92 [#/sec] (mean)
Time per request: 2191.065 [ms] (mean)
Time per request: 7.304 [ms] (mean, across all concurrent requests)
Transfer rate: 22.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.3 1 46
Processing: 286 1326 2926.0 469 21634
Waiting: 211 1323 2926.8 468 21633
Total: 290 1326 2926.0 469 21635
Percentage of the requests served within a certain time (ms)
50% 469
66% 492
75% 889
80% 1082
90% 1475
95% 7206
98% 15074
99% 15106
100% 21635 (longest request)
3. MixPHP
Nginx + PHP-FPM
C:\Server\apache24vc11\bin>ab -c 300 -n 3000 http://www.t0.com/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.t0.com (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.13.6
Server Hostname: www.t0.com
Server Port: 80
Document Path: /
Document Length: 12 bytes
Concurrency Level: 300
Time taken for tests: 8.622 seconds
Complete requests: 3000
Failed requests: 0
Total transferred: 522000 bytes
HTML transferred: 36000 bytes
Requests per second: 347.95 [#/sec] (mean)
Time per request: 862.196 [ms] (mean)
Time per request: 2.874 [ms] (mean, across all concurrent requests)
Transfer rate: 59.12 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.4 1 38
Processing: 189 518 872.4 236 7038
Waiting: 110 509 875.0 233 7037
Total: 194 519 872.4 237 7038
Percentage of the requests served within a certain time (ms)
50% 237
66% 252
75% 294
80% 316
90% 1231
95% 1253
98% 3230
99% 7004
100% 7038 (longest request)
4. Phalcon
Nginx + PHP-FPM
C:\Server\apache24vc11\bin>ab -c 300 -n 3000 http://www.t3.com/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.t3.com (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.13.6
Server Hostname: www.t3.com
Server Port: 80
Document Path: /
Document Length: 13 bytes
Concurrency Level: 300
Time taken for tests: 1.825 seconds
Complete requests: 3000
Failed requests: 0
Total transferred: 483000 bytes
HTML transferred: 39000 bytes
Requests per second: 1643.63 [#/sec] (mean)
Time per request: 182.523 [ms] (mean)
Time per request: 0.608 [ms] (mean, across all concurrent requests)
Transfer rate: 258.42 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.9 1 36
Processing: 8 167 30.0 176 224
Waiting: 8 96 49.7 95 222
Total: 9 168 30.1 176 225
WARNING: The median and mean for the initial connection time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 176
66% 179
75% 181
80% 182
90% 185
95% 186
98% 188
99% 189
100% 225 (longest request)
4. MixPHP
Nginx + MixHttpd
C:\Server\apache24vc11\bin>ab -c 300 -n 3000 http://www.a.com/
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.a.com (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.13.6
Server Hostname: www.a.com
Server Port: 80
Document Path: /
Document Length: 12 bytes
Concurrency Level: 300
Time taken for tests: 1.360 seconds
Complete requests: 3000
Failed requests: 0
Total transferred: 504000 bytes
HTML transferred: 36000 bytes
Requests per second: 2205.60 [#/sec] (mean)
Time per request: 136.017 [ms] (mean)
Time per request: 0.453 [ms] (mean, across all concurrent requests)
Transfer rate: 361.86 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.1 1 40
Processing: 8 119 22.3 123 226
Waiting: 3 66 35.4 65 224
Total: 8 119 22.4 123 227
Percentage of the requests served within a certain time (ms)
50% 123
66% 125
75% 126
80% 126
90% 136
95% 143
98% 146
99% 147
100% 227 (longest request)
测试结果
框架 | 环境 | RPS |
---|---|---|
Yii | Nginx + PHP-FPM | 92.93 |
CodeIgniter | Nginx + PHP-FPM | 136.92 |
MixPHP | Nginx + PHP-FPM | 347.95 |
Phalcon | Nginx + PHP-FPM | 1643.63 |
MixPHP | Nginx + MixHttpd | 2205.60 |