2017 非标准 PHP 框架性能测试比较

我最近在给tastphp 完善说明文档 有一节是性能测试比较 ,才有了下面这个项目

项目托管地址: https://github.com/xujiajun/php-framework-...

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

php framework benchmark (include laravelsymfonysilexlumenslimyii2tastphp)

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

补充下:所有项目都是生成环境的,有框架本身cache优化的,都有执行(比如laravel php artisan config:cache、php artisan route:cache )其他同理,并优化 Composer 自动加载(composer install --optimize-autoloader)

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

测试的环境

OS Name:        Mac OS X
OS Version:     10.12.6
Architecture:   x86_64
CPU:Intel Core i7  1.7 GHz *2
RAM:8 GB
PHP version 7.1.10

各个框架的版本

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

测试结果

php-framework-vs.png

Detail

Laravel ab test

Laravel version 5.5.0

optimization

run commands before test:

composer install --optimize-autoloader
php 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        laravel-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   3.295 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      982346 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.8      0       8
Processing:    22  311  59.4    315     571
Waiting:       22  311  59.4    315     571
Total:         30  312  58.0    315     571

Percentage 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        lumen-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   0.639 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      199000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.9      0       6
Processing:     9   61   9.9     62      74
Waiting:        9   61   9.9     62      74
Total:         14   61   9.1     62      74

Percentage 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        symfony-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   1.716 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      237000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.9      0       5
Processing:    12  163  34.6    168     218
Waiting:       12  163  34.6    168     218
Total:         17  163  33.9    169     218
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%    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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        silex-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   0.747 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      237000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.9      0       4
Processing:    15   71   9.3     73      88
Waiting:       15   71   9.3     73      88
Total:         20   72   8.6     73      89

Percentage 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        slim-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   0.703 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      333000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.0      0       5
Processing:     7   67  15.7     65     210
Waiting:        7   66  15.7     65     210
Total:         12   67  15.1     66     210

Percentage 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        yii2-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   0.649 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      165000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.0      0       5
Processing:    16   62   9.2     61      96
Waiting:       16   62   9.2     61      96
Total:         21   62   9.2     61      98

Percentage 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-autoloader
php bin/console cache:config
php 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.yml
version: v1.3.6
debug: false
secret: tastphp
# dev | test | prod
env: prod
timezone: UTC
name: 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 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        nginx/1.12.0
Server Hostname:        tastphp-benchmark.dev
Server Port:            80

Document Path:          /
Document Length:        2 bytes

Concurrency Level:      100
Time taken for tests:   0.487 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      165000 bytes
HTML transferred:       2000 bytes
Requests 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] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.8      0       4
Processing:     7   46   7.5     48      55
Waiting:        7   46   7.5     48      55
Total:         11   46   6.8     48      56

Percentage 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 的简单优雅好用

中文文档: https://github.com/tastphp/tastphp-docs/bl...

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

本作品采用《CC 协议》,转载必须注明作者和本文链接
本帖由系统于 5年前 自动加精
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 29

虽然看标题就知道这应该是广告文,不过没事,毕竟选择一个框架,性能只是一个方面,更多需要考量的是:

  1. 作者的资历,这是代码质量的前提;
  2. 安全,是否已经有大量的人使用,是否有活跃的 PR 及快速的 issue 处理速度保障;
  3. 生态,这也是 Laravel 被大家认可最重要的一点;
  4. 圈子,这决定了遇到问题时除了作者,你是否还有其它人可以互助;
  5. 功能,通常情况下,性能高的框架,功能都特别简单(C 拓展除外),满足不了项目需求。

特别要说一下最后一点,关于性能,任何一个项目都不可能简单到性能测试的代码那么简单,不是输出一段内容,或者加上几个数据库查询就能解决的。如果你尝试用不同的框架完成一个复杂的项目,同样的功能,最后再对所有 feature 进行测试汇总,你会发现这些框架的性能对比差异真的只有一点点了。另外,你会发现,性能好的框架上完成这个项目的时间基本上是 Laravel 这样功能齐全框架的 2 倍以上,你需要花费更多的时间在功能集成上。

我曾经试过把公司一个项目(我们3个人开发了3个月),从旧框架改到 Laravel,我一个人用一个月搞定上线(并且还重新搞了后台 UI)。就凭这点体验,我宁愿花钱买服务器(真的超便宜),也不愿意花钱在开发成本上。花 10 万,我能搞定多少服务器?但是如果换成开发人员工资呢?半年左右吧。

所以,说这么多并不是驳斥你的做法,如果想要推广你的框架,你需要做得还有好多好多,加油!:smile:

6年前 评论

虽然看标题就知道这应该是广告文,不过没事,毕竟选择一个框架,性能只是一个方面,更多需要考量的是:

  1. 作者的资历,这是代码质量的前提;
  2. 安全,是否已经有大量的人使用,是否有活跃的 PR 及快速的 issue 处理速度保障;
  3. 生态,这也是 Laravel 被大家认可最重要的一点;
  4. 圈子,这决定了遇到问题时除了作者,你是否还有其它人可以互助;
  5. 功能,通常情况下,性能高的框架,功能都特别简单(C 拓展除外),满足不了项目需求。

特别要说一下最后一点,关于性能,任何一个项目都不可能简单到性能测试的代码那么简单,不是输出一段内容,或者加上几个数据库查询就能解决的。如果你尝试用不同的框架完成一个复杂的项目,同样的功能,最后再对所有 feature 进行测试汇总,你会发现这些框架的性能对比差异真的只有一点点了。另外,你会发现,性能好的框架上完成这个项目的时间基本上是 Laravel 这样功能齐全框架的 2 倍以上,你需要花费更多的时间在功能集成上。

我曾经试过把公司一个项目(我们3个人开发了3个月),从旧框架改到 Laravel,我一个人用一个月搞定上线(并且还重新搞了后台 UI)。就凭这点体验,我宁愿花钱买服务器(真的超便宜),也不愿意花钱在开发成本上。花 10 万,我能搞定多少服务器?但是如果换成开发人员工资呢?半年左右吧。

所以,说这么多并不是驳斥你的做法,如果想要推广你的框架,你需要做得还有好多好多,加油!:smile:

6年前 评论

公平起见,建议把下面这个的测试数据也加上。

https://github.com/qufo/hellophp

6年前 评论
xujiajun

@johnlui 帅哥 谢谢你的回答。
我来回答下的疑惑:
1、 这个写法似曾相识呀
答:你想说明啥? 我抄了哪一款框架?如有雷同纯属巧合
2 、
以及我看了看 framework 的源码,一个 interface 都没有建议别伪装成 Container 控制反转了。。。

答:tastphp框架的核心就是依赖注入。底层container基于Pimple(后面会做一点定制),是鼎鼎大名的symfony作者(fabpot)[https://github.com/fabpot]写的。我不知道他写的container都不算控制反转,那我也没啥可以说了。。。
github地址:https://pimple.symfony.com/

还有一个interface接口都没有,我想说你真的看代码了吗。。

<?php
namespace TastPHP\Framework\Container;
/**
 * Class PimpleContainer
 * @package TastPHP\Framework\Container
 */
class PimpleContainer implements \Psr\Container\ContainerInterface

最后还是谢谢你的关注 如果你觉得我写的不到位的,继续帮我主持,感谢:smile:

6年前 评论
happyqian_ah

开源的东东都要支持一下。

6年前 评论

建议把我才写的极简框架也加入性能测试,核心代码只有两行,优雅强大的同时满足你对性能的极致需求:joy:
框架代码如下:

<?php
    $url = $_SERVER['PATH_INFO'] ?? '/';

    switch ($url === '/' ? 'index' : ltrim($url, '/')) {
        case 'index':
            echo 'Hello World.';
            break;
        case 'benchmark':
            echo 'I AM SO FAST!!!';
            break;
        default:
            echo '404';
            break;
    }
6年前 评论

加油,加油,共同进步

6年前 评论
Summer

@overtrue 『颜值即正义』,超神人帅观点也好,不能同意更多,哈哈。

@xujiajun 框架作者也要加油哈,持续关注中 :smile:

6年前 评论
xujiajun

@岳池 谢谢;)

6年前 评论

以及我看了看 framework 的源码,一个 interface 都没有建议别伪装成 Container 控制反转了。。。

6年前 评论
xujiajun

还有些童鞋让我测<?php echo "hello world"; 我为什么没放进来,因为没啥可以比较的,因为没有人不用框架开发,

还有c框架 也没放进来,因为tastphp 和c框架比性能 没啥意义,肯定比不过。

最后 题目是 "2017 非标准 PHP 框架性能测试比较" 重点看 “非标准" 大家有点娱乐精神 好不好 不比太较真

重点是 给tastphp 来个 Star ?

6年前 评论
xujiajun

@Payne 谢谢回复。请关注下tastphp的文档:https://github.com/tastphp/tastphp-docs 我当时候会说明为什么tastphp性能比一般的高。

6年前 评论

来搞事情了,这个要火啊:laughing:

6年前 评论
Jourdon

我是觉得自己测试就好了,没必要拿出来,而且第三方测试会有说服力一些,你说呢?
不管怎么样,支持开源!!

6年前 评论

开源项目支持一波

5年前 评论

这个东西,怎么感觉是用汽车和飞机比那,并且规定 100M的距离;谁快很明显吗。不是故意找茬, :blush:

4年前 评论
$app = new TastPHP\App\AppKernel();
$app->run();

这种写法似曾相识呀

6年前 评论

从图表中可以看到yii2、slim3、lumen5.5这三个框架的QPS都是差不多的,而你的框架却高出它们一截,能解释一下原因吗?

6年前 评论
巴啦啦

还是那个回复。请用thinkphp3.2,测试Hello World。

6年前 评论

厉害厉害,把各个框架所做的优化配置再补充上去更好,
比如同时开启路由缓存:
laravel 的: route:cache
Yii2 的: urlManage::cache
symfony 的:生产模式

6年前 评论

Phalcon 这个框架没测试

6年前 评论
xujiajun

@overtrue 谢谢回复。大部分认同你的观点。

1、 作者的资历 (我不敢说我很牛 , 但我一定很认真对待 , 每一个给我提善意建议的人)

2、 安全 (目前来看只能我来第一时间处理,可能是硬伤,没有更多的contribute。比如tastphp framwork 国外没有宣传 ,就有人帮我提交PR了,这个感觉国外更乐于参与)

3、 生态 (说白了 是影响力问题,有影响力的产品 肯定有他的好 就好比名牌产品 ,但是民间的手艺人就一定差吗 )
4、 圈子 (同生态 道理一样 是影响力问题 。更由于 作者我周边 开源爱好者 有限,才发网络社区 )
5 、功能 (tastphp 可以支持小、中、大各个阶段的项目,到后面 客观讲 已经不是框架层面了的事情,应该是架构了)

关于开发效率,事实胜于雄辩,如果我还在维护框架,我会出一篇文章写tastphp的高效开发。

关于tastphp的开发的背景 我也在文档说明了 https://github.com/tastphp/tastphp-docs/bl...

其实我认为 学习成本才是对团队的硬伤。

关于框架的本地性能评测输出 :hello 之类的 有没有意义 ,一些前辈已经很多在做了,包括一些框架作者,比如laravel作者,yii官网等,我就不多说了。

的确做开源项目,除了开发外,还要宣传推广。让人来参与使用或者参与进来,最重要的是 如果没人关注,的确也会影响作者继续开发维护的动力。毕竟开源出来还是给人用的。 这也是很多开源项目的作者做着做着 项目最后停掉的一个比较重要的原因吧。
如果做下去,要做的事情的确太多。。
比如下一次分享 我要说明 我如何保证tastphp框架一定性能的前提 还能有超高的开发效率 :smile:

6年前 评论

虽然知道这是 Laravel 社区,但是还是颤颤巍巍插句话,在性能敏感的业务里除了 PHP 大家也可以考虑下 Node.js。开发速度同样很快,但速度提升不是一点点。逃。。。:joy:

file

6年前 评论

我不知道这种基于hello world的测试有什么意义?
laravel在开发中愉快的体验,远远抵消了性能的劣势

6年前 评论
xujiajun

@施国鹏 基本上这个按照他们官方网站的优化,可能有疏漏。如果你觉得不合理 可以把提PR给我那个测试项目:https://github.com/xujiajun/php-framework-...

不过我刚才看了https://medium.com/@taylorotwell/benchmarking-laravel-symfony-zend-2c01c2b270f8#.kf4gywdmg 按照他注释了

我没注释前的确一开始有cookie

    protected $middlewareGroups = [
        'web' => [
            // \App\Http\Middleware\EncryptCookies::class,
            // \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            // \Illuminate\Session\Middleware\StartSession::class,
            // // \Illuminate\Session\Middleware\AuthenticateSession::class,
            // \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            // \App\Http\Middleware\VerifyCsrfToken::class,
            // \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

    protected $routeMiddleware = [
        // 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
        // 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        // 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        // 'can' => \Illuminate\Auth\Middleware\Authorize::class,
        // 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        // 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    ];

测了下 依然很慢,今天测比上次还qps还低。。。

6年前 评论

其他框架默认是开启session的吗?

6年前 评论

说实话,个人觉得这种测试是无意义的,也是没有参考价值的。

<?php

echo 'ok';

最快!:smile:

换一种思路,可能针对某一个实现去比较比较好,比如,blog 啥的。

6年前 评论
xujiajun

@deepziyu

关于laravel,我已经说明了跑之前 :

run commands before test:

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

另外,包括 symfony 在内的都是全部测试框架都是 生产模式的比较。

Yii2 的优化: urlManage::cache 没做 ,我回头去补测下

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!