I haven't looked into this but I'm very interested to see the discussion. I imagine removing all the aliases and facades would help a lot.
First, run php artisan optimize
, second install APC (of enable opcache in php5.5)
If you want real speed for cached pages, you can use Varnish (or the slower but easier to setup HttpCache from symfony; https://github.com/barryvdh/laravel-httpcache). I go from around 250ms to 70ms for my own website, when using httpcache (but doesn't work for user specific content etc)
And disable the ServiceProviders you don't need.
You can also compile more files, if you use those files on every request. Check the files datacollector from my debugbar (enable it in the config) and you can see which files are loaded. You can add some of the classes to the config/compiled.php file and run php artisan optimize --force
to test it. (But this could break it, and then you would need to delete bootstrap/compiled.php manually and try again).
Also remember to use caching, to prevent unnecessary calls to files or the database.
kameron522 liked this reply
@barryvdh ; WIll look into that...
I am trying to get this response time for a login action (via AJAX).
I need it to be really fast. So, I tried writing a vanilla php script and managed to get <40ms response.
But, I have no clue how to verify user password without touching laravel !
I noticed that on my windows computer the booting time was near 200ms, but once the application was deployed to the linux server, the total load time of each page was under 60ms and this is for a twin core linode virtual box so there must be something weird going on with windows.
carbontwelve said:
I noticed that on my windows computer the booting time was near 200ms, but once the application was deployed to the linux server, the total load time of each page was under 60ms and this is for a twin core linode virtual box so there must be something weird going on with windows.
Or, it's just further evidence that Windows sucks? ;)
There are lots of ways to optimize Laravel performance.
First of all, there are PHP artisan commands:
php artisan optimize
php artisan config:cache
php artisan route:cache
You can use these commands to precompile the assets.
You can also use Eager Loading with Eloquent. This will retrieve all the associated object models in response to the initial query.
You can cache query results as well. Use following command for this:
$posts = Cache::remember('index.posts', 30, function()
{return Post::with('comments', 'tags', 'author', 'seo')->whereHidden(0)->get();});
Source: complete list of Laravel performance optimization tips.
I think you can optimize laravel site performance by this link: https://itsolutionstuff.com/post/how-to-improve-speed-performance-using-model-caching-in-laravel-56example.html
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community