spooky
spooky

Reputation: 421

Identifying Bottleneck on Laravel app with Blackfire Profiling

I'm trying to get my TTFB down to under 200ms. Currently it is over 600ms.

My app uses Laravel with AsgardCMS. I have implemented very little custom code, and the database has 28 tables with less than 100 records in total.

I have installed Redis caching (and turned caching on), and run php artisan optimize.

I am also using Nginx with Apache via Engintron.

Basically I have tried to eliminate as much of the bottleneck as I can!

However, after installing Blackfire, it is reporting that Composer\Autoload\includeFile is taking a total of 250ms on its own (over 299 calls).

Illuminate\Container\Container::build is also being called 141 times with total time of 49ms.

I accept that it's normal for the autoloader to be called this many times, but should it really be taking 250ms?

My VPS has 2 cores (Intel Xeon CPU) and 4GB RAM (dedicated). I just upgraded from 1 core and 2GB RAM, but barely noticed any difference. Disks are SSD. Running on WHM/cPanel btw. Around 10 sites on the server, but none of them particularly high traffic, and these tests have been run during the quietest periods.

In the last test run, Blackfire reported:-

Time: 696ms
I/O Wait: 149ms
CPU time: 548ms
SQL Queries: 2.38ms

Any ideas? Pretty please...

Upvotes: 1

Views: 1389

Answers (1)

spooky
spooky

Reputation: 421

Whilst I didn't get to the bottom of whether or not there was an issue with the server, or the PHP code, or if the "slowness" of the app was to be expected, following the comments on this thread and the comments on the link provided by @teeyo (https://laracasts.com/discuss/channels/laravel/adventures-in-increasing-laravel-performance) I decided to test out PHP7.

WHM made it easy to enable PHP7 for this account only, so that was pretty straightforward. Ran another test, which came out about 400ms - awesome, but still not under 200ms.

So, I decided to try and enable PHP-FPM, which also was a sinch via WHM...

F*** ME! Now i'm getting around 100ms! And to top it off, if I disable Engintron, I shave another 10-20ms off that!! (Although that probably isn't recommended for high traffic sites, as then it won't benefit from nginx reverse proxy).

Anyway, thanks all for your input... hope this helps others...

Upvotes: 1

Related Questions