mercredi 1 juin 2016

How to find bottleneck in Laravel?

I have a large application written using Laravel 5.2. The application seems to be running slow. Sometimes the application runs smooth and other it runs very slow. I am trying to figure out what could be causing the speed degrade. To get started I listed the top 4 categories that I should review to reviews

  1. SQL problems
  2. Code problem which could be causing extra/not needed work
  3. Web Server Issues
  4. Network Issues.

For the first category "i.e. SQL Problems" I evaluated all of the queries and everything seems to be light and fairly fast. There is no log running queries and I find no locks. Although I did not eliminate this as a possible issue but for now it is fair to look elsewhere. One thing to note that the application is generating lots of queries which suggests that I may be running into the N+1 case.

While categories 3 and 4 ad important, I like to focus some time on the second category "i.e. Code problem" where I need help. I need to be able to figure out couple of things to determine which classes could be causing problems. Here are few thing that I like to know/start logging.

  1. How long each class takes to execute to see if one takes longer time to run.
  2. How many/list of all queries that being generated from each class where I can identify the source of the N+1 case.

I am using Clockwork extension in Google Chrome which is helping me a log. But, I am unable to break down the result at the class level which will give me a deep understanding of what is going on.

How can gather the 2 items listed above? Is it possible to hook into Clockwork and add that info as a filter to it where I just see all that into Google Extension?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire