博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2017 非标准 PHP 框架性能测试比较
阅读量:6325 次
发布时间:2019-06-22

本文共 12682 字,大约阅读时间需要 42 分钟。

我最近在给 完善说明文档 有一节是 ,才有了下面这个项目

项目托管地址:

针对github上比较活跃的几个开源项目,做了简单的比较。供大家参考:

php framework benchmark (include 、、、、、、)

所有框架仅输出 "ok",就仅测试框架的本身的性能。如果有精力可以测下带有数据库交互的测试。

以下测试仅供参考,如果你想测的准,建议在生产环境测试!

测试的环境

OS Name:        Mac OS XOS Version:     10.12.6Architecture:   x86_64CPU:Intel Core i7  1.7 GHz *2RAM:8 GBPHP version 7.1.10opcache 开的

各个框架的版本

Laravel version 5.5.0Lumen version 5.5.0symfony version 3.3.10Silex version 2.0.2Silm version 3.1.4yii2 version 2.0.12Tastphp version 1.3.6

测试结果

<img src=''>

Detail

Laravel ab test

Laravel version 5.5.0

run commands before test:

composer install --optimize-autoloaderphp artisan config:cache// php artisan route:cache  //cannot use route caching if you have ANY route closures

ab test result:

➜  laravel-5.5.0 git:(master) ✗ ab -n 1000 -c 100 http://laravel-benchmark.dev/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 laravel-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        laravel-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   3.295 secondsComplete requests:      1000Failed requests:        0Total transferred:      982346 bytesHTML transferred:       2000 bytesRequests per second:    303.46 [#/sec] (mean)Time per request:       329.538 [ms] (mean)Time per request:       3.295 [ms] (mean, across all concurrent requests)Transfer rate:          291.11 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    1   1.8      0       8Processing:    22  311  59.4    315     571Waiting:       22  311  59.4    315     571Total:         30  312  58.0    315     571Percentage of the requests served within a certain time (ms)  50%    315  66%    335  75%    351  80%    354  90%    362  95%    367  98%    378  99%    407 100%    571 (longest request)

Lumen version 5.5.0

run commands before test:

composer install --optimize-autoloader

ab test result:

➜  lumen-5.5.0 git:(master) ✗ ab -n 1000 -c 100 http://lumen-benchmark.dev/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 lumen-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        lumen-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   0.639 secondsComplete requests:      1000Failed requests:        0Total transferred:      199000 bytesHTML transferred:       2000 bytesRequests per second:    1565.02 [#/sec] (mean)Time per request:       63.897 [ms] (mean)Time per request:       0.639 [ms] (mean, across all concurrent requests)Transfer rate:          304.14 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   0.9      0       6Processing:     9   61   9.9     62      74Waiting:        9   61   9.9     62      74Total:         14   61   9.1     62      74Percentage of the requests served within a certain time (ms)  50%     62  66%     64  75%     65  80%     66  90%     68  95%     71  98%     72  99%     73 100%     74 (longest request)

Symfony version 3.3.10

run commands before test:

composer install --optimize-autoloader

ab test result:

➜  symfony-3.3.10 git:(master) ✗ ab -n 1000 -c 100 http://symfony-benchmark.dev/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 symfony-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        symfony-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   1.716 secondsComplete requests:      1000Failed requests:        0Total transferred:      237000 bytesHTML transferred:       2000 bytesRequests per second:    582.60 [#/sec] (mean)Time per request:       171.646 [ms] (mean)Time per request:       1.716 [ms] (mean, across all concurrent requests)Transfer rate:          134.84 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    1   0.9      0       5Processing:    12  163  34.6    168     218Waiting:       12  163  34.6    168     218Total:         17  163  33.9    169     218WARNING: 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%    169  66%    176  75%    184  80%    187  90%    199  95%    207  98%    211  99%    213 100%    218 (longest request)

Silex version 2.0.2

run commands before test:

composer install --optimize-autoloader

ab test result:

➜  silex-2.0.2 git:(master) ✗ ab -n 1000 -c 100 http://silex-benchmark.dev/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 silex-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        silex-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   0.747 secondsComplete requests:      1000Failed requests:        0Total transferred:      237000 bytesHTML transferred:       2000 bytesRequests per second:    1338.53 [#/sec] (mean)Time per request:       74.709 [ms] (mean)Time per request:       0.747 [ms] (mean, across all concurrent requests)Transfer rate:          309.80 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   0.9      0       4Processing:    15   71   9.3     73      88Waiting:       15   71   9.3     73      88Total:         20   72   8.6     73      89Percentage of the requests served within a certain time (ms)  50%     73  66%     74  75%     75  80%     76  90%     79  95%     81  98%     82  99%     84 100%     89 (longest request)

slim version 3.1.4

run commands before test:

composer install --optimize-autoloader

ab test:

➜  silm-3.1.4 git:(master) ✗ ab -n 1000 -c 100 http://slim-benchmark.dev/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 slim-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        slim-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   0.703 secondsComplete requests:      1000Failed requests:        0Total transferred:      333000 bytesHTML transferred:       2000 bytesRequests per second:    1423.44 [#/sec] (mean)Time per request:       70.252 [ms] (mean)Time per request:       0.703 [ms] (mean, across all concurrent requests)Transfer rate:          462.90 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   1.0      0       5Processing:     7   67  15.7     65     210Waiting:        7   66  15.7     65     210Total:         12   67  15.1     66     210Percentage of the requests served within a certain time (ms)  50%     66  66%     69  75%     70  80%     72  90%     88  95%     96  98%    102  99%    105 100%    210 (longest request)

yii2 version 2.0.12

run commands before test:

composer install --optimize-autoloader

ab test result:

➜  yii2-2.0.12 git:(master) ✗ ab -n 1000 -c 100 http://yii2-benchmark.dev/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 yii2-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        yii2-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   0.649 secondsComplete requests:      1000Failed requests:        0Total transferred:      165000 bytesHTML transferred:       2000 bytesRequests per second:    1539.74 [#/sec] (mean)Time per request:       64.946 [ms] (mean)Time per request:       0.649 [ms] (mean, across all concurrent requests)Transfer rate:          248.10 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   1.0      0       5Processing:    16   62   9.2     61      96Waiting:       16   62   9.2     61      96Total:         21   62   9.2     61      98Percentage of the requests served within a certain time (ms)  50%     61  66%     64  75%     67  80%     69  90%     73  95%     77  98%     89  99%     94 100%     98 (longest request)

Tastphp version 1.3.6

run commands before test:

composer install --optimize-autoloaderphp bin/console cache:configphp bin/console cache:route➜  tastphp-1.3.6 git:(master) mv config/example.app.yml config/app.yml➜  tastphp-1.3.6 git:(master) cat config/app.ymlversion: v1.3.6debug: falsesecret: tastphp# dev | test | prodenv: prodtimezone: UTCname: tastphp

ab test result:

➜  tastphp-1.3.6 git:(master) ✗ ab -n 1000 -c 100 http://tastphp-benchmark.dev/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 tastphp-benchmark.dev (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:        nginx/1.12.0Server Hostname:        tastphp-benchmark.devServer Port:            80Document Path:          /Document Length:        2 bytesConcurrency Level:      100Time taken for tests:   0.487 secondsComplete requests:      1000Failed requests:        0Total transferred:      165000 bytesHTML transferred:       2000 bytesRequests per second:    2051.92 [#/sec] (mean)Time per request:       48.735 [ms] (mean)Time per request:       0.487 [ms] (mean, across all concurrent requests)Transfer rate:          330.63 [Kbytes/sec] receivedConnection Times (ms)              min  mean[+/-sd] median   maxConnect:        0    0   0.8      0       4Processing:     7   46   7.5     48      55Waiting:        7   46   7.5     48      55Total:         11   46   6.8     48      56Percentage of the requests served within a certain time (ms)  50%     48  66%     49  75%     50  80%     51  90%     52  95%     53  98%     54  99%     55 100%     56 (longest request)

广告时间

start 关注下:

?

  • tastphp 骨架:
  • tastphp 内核:

最近也在编写以实际项目来说明 tastphp 的简单优雅好用

中文文档:

欢迎 PR、issure 给我 你的 star,确实给我不小鼓励!让我坚持下去。祝国内产生更多优秀的开源产品!

转载地址:http://cxmaa.baihongyu.com/

你可能感兴趣的文章
Oracle执行计划
查看>>
js 时间格式化 兼容safari 苹果手机
查看>>
Yii 中,render 和 renderPartial 的区别[转]
查看>>
第67天:面向对象的声明、封装
查看>>
51nod 1105 第K大的数
查看>>
javaScript异常示范案例
查看>>
Android中如何实现EditText的自动换行
查看>>
01-Scrum 概述
查看>>
bzoj 4556 [Tjoi2016&Heoi2016]字符串——后缀数组+主席树
查看>>
TensorFlow+实战Google深度学习框架学习笔记(10)-----神经网络几种优化方法
查看>>
SECTION 4: THE TIMEQUEST GUI
查看>>
window's chkdsk
查看>>
WCF序列化
查看>>
Host+DLL模式下快捷键的使用
查看>>
notepad++添加Compare插件
查看>>
[游戏学习22] MFC 井字棋 双人对战
查看>>
Qt中的qreal
查看>>
Codeforces Beta Round #95 (Div. 2) D.Subway
查看>>
企业搜索引擎开发之连接器connector(二十)
查看>>
HeadFirst Jsp 09 (JSTL)
查看>>