我只是在路由文件中设置了这个页面web.php:
Route::get("/speedtest","SpeedController@speed_test");
Run Code Online (Sandbox Code Playgroud)
这是速度测试功能:
public function speed_test(){
return view("speedtest");
}
Run Code Online (Sandbox Code Playgroud)
返回speedtest.blade.php只包含一个hello world.
加载此页面需要2.5秒到3.5秒.
其他使用中间件和一些查询的页面需要3.5到6.5秒.数据库几乎是空的,查询只返回3或4个项目(类似的东西Files::where(user_id, Auth::user()->id)->get()).
所以一切都很慢,甚至是空的网站.绝对有问题.
该站点单独位于具有4 GB RAM,SSD和1 Gbit连接的服务器中
有帮助吗?
The*_*ith 10
要提高速度的事情:
# Optimize the autoloading (very important!)
composer dumpautoload -o
# Cache the Laravel routes (very important on slower servers)
php artisan route:cache
php artisan api:cache
# Cache the core laravel configurations (including service providers, etc.)
php artisan config:cache
# Finally, tell Laravel to enable "production-ready optimizations."
#php artisan optimize # No longer needed/available in Laravel 5.6.
Run Code Online (Sandbox Code Playgroud)
运行所有这些并报告时间的改进!
为了获得最佳性能,还要确保安装并加载Zend OPcache扩展(这是另一个问题).
php -m
....
[Zend Modules]
Zend OPcache
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3350 次 |
| 最近记录: |