I just set this page in the routing file web.php
:
Route::get("/speedtest","SpeedController@speed_test");
Here is the speed test function:
public function speed_test(){
return view("speedtest");
}
That returns speedtest.blade.php
which contains just a hello world
.
It takes between 2.5 s and 3.5 to load this page.
Other pages that use a middleware and some queries needs between 3.5 and 6.5 seconds. The database is almost empty and the queries returns just 3 or 4 items (something like Files::where(user_id, Auth::user()->id)->get()
).
So everything is slow, even empty sites. There is definitely something wrong.
The site is alone in a server with 4 GB RAM, SSD and 1 Gbit connection
Any help?
Things to do to increase speed:
# 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 all that and report the time improvements!
You also, for best performance, make sure that Zend OPcache extension is installed and loaded (that's another question).
php -m
....
[Zend Modules]
Zend OPcache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With