码迷,mamicode.com
首页 > Web开发 > 详细

Phalcon2.0.x 和 Laravel5 PHP框架性能测试

时间:2016-05-12 18:27:41      阅读:443      评论:0      收藏:0      [点我收藏+]

标签:

Phalcon2.0.x 和 Laravel5 PHP框架性能测试

版本PHP5.6.9,测试工具AB,由于本人较懒,测试环境是在虚拟机上面的docker进行操作。

由于公司项目需要,对比了Laravel和Phalcon框架。
不懂看数值的,看Time taken for tests就好。
这个是总时间,越少越好。

测试工作:
测试laravel : 在laravel框架的控制器中输出一行文字,并退出。
测试phalcon:在phalcon框架的控制器中输出一行文字,并退出。
测试原生 :在laravel的index.php中输出一行文字,并退出。

利用ab进行模拟16个用户并发请求,请求次数为10000次

Laravel 第一次测试

Server Software:        nginx/1.9.12
Server Hostname:        www.laravel_test.com
Server Port:            80

Document Path:          /test
Document Length:        13 bytes

Concurrency Level:      16
Time taken for tests:   937.895 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      9921112 bytes
HTML transferred:       130000 bytes
Requests per second:    10.66 [#/sec] (mean)
Time per request:       1500.632 [ms] (mean)
Time per request:       93.789 [ms] (mean, across all concurrent requests)
Transfer rate:          10.33 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0      21
Processing:   475 1499 597.7   1368   10381
Waiting:      475 1499 597.7   1368   10381
Total:        476 1500 597.7   1368   10381

Percentage of the requests served within a certain time (ms)
  50%   1368
  66%   1511
  75%   1617
  80%   1697
  90%   1950
  95%   2286
  98%   3067
  99%   3988
 100%  10381 (longest request)

Laravel 第二次测试

Server Software:        nginx/1.9.12
Server Hostname:        www.laravel_test.com
Server Port:            80

Document Path:          /test
Document Length:        13 bytes

Concurrency Level:      16
Time taken for tests:   1137.227 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      9921340 bytes
HTML transferred:       130000 bytes
Requests per second:    8.79 [#/sec] (mean)
Time per request:       1819.564 [ms] (mean)
Time per request:       113.723 [ms] (mean, across all concurrent requests)
Transfer rate:          8.52 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0      22
Processing:   530 1818 1124.8   1610   14013
Waiting:      530 1818 1124.8   1610   14013
Total:        530 1819 1124.9   1610   14013

Percentage of the requests served within a certain time (ms)
  50%   1610
  66%   1733
  75%   1826
  80%   1905
  90%   2166
  95%   2533
  98%   6930
  99%   8809
 100%  14013 (longest request)

phalcon 第一次测试

Server Software:        nginx/1.9.12
Server Hostname:        www.phalcon_test.com
Server Port:            80

Document Path:          /
Document Length:        13 bytes

Concurrency Level:      16
Time taken for tests:   25.374 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      1750000 bytes
HTML transferred:       130000 bytes
Requests per second:    394.10 [#/sec] (mean)
Time per request:       40.599 [ms] (mean)
Time per request:       2.537 [ms] (mean, across all concurrent requests)
Transfer rate:          67.35 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.1      0      16
Processing:    15   40  16.3     36     166
Waiting:       14   39  16.2     35     166
Total:         15   41  16.3     37     167

Percentage of the requests served within a certain time (ms)
  50%     37
  66%     43
  75%     47
  80%     51
  90%     61
  95%     72
  98%     86
  99%     97
 100%    167 (longest request)

phalcon 第二次测试

Server Software:        nginx/1.9.12
Server Hostname:        www.phalcon_test.com
Server Port:            80

Document Path:          /
Document Length:        13 bytes

Concurrency Level:      16
Time taken for tests:   28.657 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      1750000 bytes
HTML transferred:       130000 bytes
Requests per second:    348.96 [#/sec] (mean)
Time per request:       45.851 [ms] (mean)
Time per request:       2.866 [ms] (mean, across all concurrent requests)
Transfer rate:          59.64 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4  87.3      0    3007
Processing:     5   42 101.4     34    3080
Waiting:        3   41 101.4     33    3079
Total:          5   46 134.1     34    3086

Percentage of the requests served within a certain time (ms)
  50%     34
  66%     40
  75%     44
  80%     47
  90%     57
  95%     68
  98%     84
  99%     97
 100%   3086 (longest request)

原生测试

Server Software:        nginx/1.9.12
Server Hostname:        www.laravel_test.com
Server Port:            80

Document Path:          /test
Document Length:        13 bytes

Concurrency Level:      16
Time taken for tests:   15.365 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      1750000 bytes
HTML transferred:       130000 bytes
Requests per second:    650.85 [#/sec] (mean)
Time per request:       24.583 [ms] (mean)
Time per request:       1.536 [ms] (mean, across all concurrent requests)
Transfer rate:          111.23 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   2.2      1      32
Processing:    10   24  10.0     20     121
Waiting:        3   23   9.7     20     116
Total:         11   25  10.3     21     122

Percentage of the requests served within a certain time (ms)
  50%     21
  66%     25
  75%     28
  80%     30
  90%     37
  95%     45
  98%     56
  99%     64
 100%    122 (longest request)

结果分析:Laravel用的时间是最长的、其次Phalcon、最好的性能当然是原生PHP了

行项目是毫秒(ms),列项目是完成度(%)

技术分享

隔了一级那就是 十倍 的差距啊!

用不用框架自己考虑吧,我觉得Phalcon是最牛逼的!

Phalcon2.0.x 和 Laravel5 PHP框架性能测试

标签:

原文地址:http://blog.csdn.net/technofiend/article/details/51354707

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!