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

来源:互联网 发布:第三帝国 知乎 编辑:程序博客网 时间:2024/06/06 07:33

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.12Server Hostname:        www.laravel_test.comServer Port:            80Document Path:          /testDocument Length:        13 bytesConcurrency Level:      16Time taken for tests:   937.895 secondsComplete requests:      10000Failed requests:        0Keep-Alive requests:    0Total transferred:      9921112 bytesHTML transferred:       130000 bytesRequests 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] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   0.4      0      21Processing:   475 1499 597.7   1368   10381Waiting:      475 1499 597.7   1368   10381Total:        476 1500 597.7   1368   10381Percentage 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.12Server Hostname:        www.laravel_test.comServer Port:            80Document Path:          /testDocument Length:        13 bytesConcurrency Level:      16Time taken for tests:   1137.227 secondsComplete requests:      10000Failed requests:        0Keep-Alive requests:    0Total transferred:      9921340 bytesHTML transferred:       130000 bytesRequests 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] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   0.3      0      22Processing:   530 1818 1124.8   1610   14013Waiting:      530 1818 1124.8   1610   14013Total:        530 1819 1124.9   1610   14013Percentage 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.12Server Hostname:        www.phalcon_test.comServer Port:            80Document Path:          /Document Length:        13 bytesConcurrency Level:      16Time taken for tests:   25.374 secondsComplete requests:      10000Failed requests:        0Keep-Alive requests:    0Total transferred:      1750000 bytesHTML transferred:       130000 bytesRequests 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] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    1   1.1      0      16Processing:    15   40  16.3     36     166Waiting:       14   39  16.2     35     166Total:         15   41  16.3     37     167Percentage 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.12Server Hostname:        www.phalcon_test.comServer Port:            80Document Path:          /Document Length:        13 bytesConcurrency Level:      16Time taken for tests:   28.657 secondsComplete requests:      10000Failed requests:        0Keep-Alive requests:    0Total transferred:      1750000 bytesHTML transferred:       130000 bytesRequests 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] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    4  87.3      0    3007Processing:     5   42 101.4     34    3080Waiting:        3   41 101.4     33    3079Total:          5   46 134.1     34    3086Percentage 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.12Server Hostname:        www.laravel_test.comServer Port:            80Document Path:          /testDocument Length:        13 bytesConcurrency Level:      16Time taken for tests:   15.365 secondsComplete requests:      10000Failed requests:        0Keep-Alive requests:    0Total transferred:      1750000 bytesHTML transferred:       130000 bytesRequests 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] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    1   2.2      1      32Processing:    10   24  10.0     20     121Waiting:        3   23   9.7     20     116Total:         11   25  10.3     21     122Percentage 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是最牛逼的!

0 0
原创粉丝点击