干货laravel 5.1 性能优化对比 - 框架提供的方法
Posted 高洛峰
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了干货laravel 5.1 性能优化对比 - 框架提供的方法相关的知识,希望对你有一定的参考价值。
软件环境:
OS : windows 8.1
CPU: i3 2.4G
disk: 7200 st 500G
Server : Apache/2.4.9
php : PHP 7.0.0RC1
框架: Laravel 5.1
路由数量 : 273
测试 1 : 未开启优化
app_debug : true
php artisan route:cache : false
php artisan optimize –-force : false
Concurrency Level: 1
Time taken for tests: 8.561 seconds
Complete requests: 20
Failed requests: 0
Total transferred: 94976 bytes
html transferred: 73080 bytes
Requests per second: 2.34 [#/sec] (mean)
Time per request: 428.033 [ms] (mean)
Time per request: 428.033 [ms] (mean, across all concurrent requests)
Transfer rate: 10.83 [Kbytes/sec] received
测试 2 : 开启性能优化, 未优化 Laravel 内置方法
app_debug : false
php artisan route:cache : false
php artisan optimize –-force : false
Concurrency Level: 1
Time taken for tests: 7.048 seconds
Complete requests: 20
Failed requests: 0
Total transferred: 93576 bytes
HTML transferred: 73080 bytes
Requests per second: 2.84 [#/sec] (mean)
Time per request: 352.383 [ms] (mean)
Time per request: 352.383 [ms] (mean, across all concurrent requests)
Transfer rate: 12.97 [Kbytes/sec] received
测试3: 优化完毕
app_debug : false
php artisan route:cache : true
php artisan optimize : true
Concurrency Level: 1
Time taken for tests: 5.822 seconds
Complete requests: 20
Failed requests: 0
Total transferred: 93562 bytes
HTML transferred: 73080 bytes
Requests per second: 3.44 [#/sec] (mean)
Time per request: 291.092 [ms] (mean)
Time per request: 291.092 [ms] (mean, across all concurrent requests)
Transfer rate: 15.69 [Kbytes/sec] received
看起来性能还没有达到我的标准, 还是慢
2015年9月4日:
找了一台服务器: CentOS 7, 4核, 8G, 4M , apache 2.4, php5.6 经过优化过后性能如下
Concurrency Level: 1
Time taken for tests: 0.844 seconds
Complete requests: 20
Failed requests: 0
Total transferred: 93422 bytes
HTML transferred: 73420 bytes
Requests per second: 23.71 [#/sec] (mean)
Time per request: 42.179 [ms] (mean)
Time per request: 42.179 [ms] (mean, across all concurrent requests)
Transfer rate: 108.15 [Kbytes/sec] received
让自己机器慢的可能是自己, 而不是别人.
本文转自大牛博客,原文可点击左下角 阅读原文 查看(建议PC端查看)
以上是关于干货laravel 5.1 性能优化对比 - 框架提供的方法的主要内容,如果未能解决你的问题,请参考以下文章