PHP

Profile your PHP Applications with BlackFire


There are so many situations where you really want to monitor the performance of your web apps.

Sometimes you want to know why a certain part of the app takes donkey hours to load, other times you just want to find out ways you can increase the load time of your app.

One very good solution that gives you awesome analysis about it right now is BlackFire.

Blackfire was created by Sensiolabs ( the creator of Symfony) and it has a lot of goodies.

You have to install the Blackfire extension on your server and you can also install it on your system to enable you profile an API or a CLI application.

Follow the instructions on Blackfire site to get started.

Screen Shot 2015-11-17 at 8.19.19 PM

Once you are done with that, like I said. It has to be installed on your Server.

For someone like me that uses Heroku and Forge a lot of the times:

Heroku: Just go to your dashboard addons section and look for BlackFire and install.

You can also install it via your CLI like so:

and setting the config like so:

where BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN are your server id and tokens respectively.

For Forge users, just update the Blackfire form like so:

forge-blackfire

The easiest way to debug an application on a server where Blackfire is installed is to get the Chrome extension . Then go on a webpage, click on the Blackfire icon, and then on the big red “Profile” button. You will see a bar appear at the top of your page, it’ll run for a very short while and then give you information about the current request. It’s that simple!!!

For this case, I’ll profile an open source food social network that’s been built by some talented fellows with Laravel right now. Click here to check it out.

Screen Shot 2015-11-18 at 4.27.45 PM

 

Screen Shot 2015-11-18 at 4.28.36 PM

Screen Shot 2015-11-18 at 4.29.58 PM

Now, with these above, there are lots of information concerning your page load speed, various components of your app with the various requests and their respective speeds, the size of RAM been loaded at various route calls.

You can also profile APIs and web services like so:

Conclusion

Blackfire offers a lot of analysis. It’s still been actively developed to be better than what is right now but you should definitely try it out.

Please let me know if you have any questions or observations in the comments section below.

PROSPER OTEMUYIWA

About PROSPER OTEMUYIWA

Food Ninja, Code Slinger, Technical Trainer, Accidental Writer, Open Source Advocate and Developer Evangelist.