Find bottlenecks of slow pages with Magento Profiling

Find bottlenecks of slow pages with Magento Profiling

Probably, most of you encounter the problem that particular Magento pages are a lot slower than others.
The performance of our servers is permanently monitored by automated monitoring systems and also by engineers looking at the charts. We make sure that the server is not getting slow, and if a certain account is causing problems, we call this particular customer immediately to find a solution.
If some pages are slow, the problem is usually to be found in the PHP file or a Magento extension. Especially in extended shops, it may be very difficult to trace the problem. But if you, as a developer, have the right tools, it can save you a lot of investigations.
The built-in Magento Profiler is such a useful tool for developers .
In order to make it easier for you to find the bottlenecks of slow pages, I have written a small manual about this tool.

How to use Magento Profiler?

  • Profiling is done at the staging site, not on the live site.
  • Adjust the index.php file in the root directory and activate the following line (remove the # before the line):

    Varien_Profiler::enable();

  • GIn the Magento Admin, go to:
    System > Configuration > ADVANCED > Developer > Debug
  • On that page, put “Profiler” to “Yes“.
  • In the Magento Admin, go to:
    System > Configuration > ADVANCED > Developer > Developer Client Restrictions
  • Make sure the ‘Allowed IPs’ field is empty
  • Check these two settings when you switch ‘Configuration Scope’ to the specific Store View, on the left top.
  • Go to the slow page using the frontend.
  • On the bottom of the page, a big table with information about the Magento parts appears.
  • Copy the table to Excel. If that does not work well, try it from Internet Explorer.
  • In Excel, sort the table by column “Time”, descending.
  • JYou will see how much time it took to load each component. But beware: Some components also contain other components from the table, which is not shown in this table.
  • Look through the table from top to bottom.
  • If you see that the time used after a component diminishes a lot, chances are that that component took a lot of time itself, so it may be the one you are looking for.
  • The things you’ll find below are quite general, and definitely contain other components. So normally they are not the culprit:

    mage
    mage::dispatch::routers_match
    mage::dispatch::controller::action::*
    frontend/default/*/template/page/*columns-left.phtml

More information about the Profiler:

Keeping your Magento fit with built in profiler

About the Author
Jeroen Vermeulen
Jeroen acquired his extensive knowledge of hosting, Magento, the technology and all the rest in big-name hosting companies and during vocational training courses. In recent years he has booked considerable success as one of the top Magento programmers in Benelux and is something of a household name in that area of expertise.