What is a Magento Profiler?
Magento profiler is an internal PHP debugging tool. It permits you to gather data about controllers, actions, blocks, templates, events, etc. on different application execution stages.
Magento debug permits you to get a report regarding how much time each feature or part of Magento is taking to load. This report gives you a fair idea about what is slowing down the site.
We will cover the following topics in the article:-
- Why and How to use Magento Profiler?
- How to enable Magento Profiler?
- What do the Magento Profiler Results mean?
- What if profiler output is not visible on the store frontend?
Why and How to use Magento Profiler?
Magento is one of the most popular platforms among e-commerce store owners as it covers all their needs and expectations. It has a wide variety of features and extensions to improve the performance and overall functionality of the site.
To use Magento extensions and features o full extent, it is essential that servers are dedicated and powerful. But what if your Magento site takes a lot of time to load? Or you are not able to utilize all its features correctly.
There can be many reasons behind the high load time of your e-commerce website such as:-
- Incorrect Magento code profile
- A rapid increase in web traffic
- A lot of heavy files
- Use of excessive plug-ins
- Too many redirects
- Server location
- Server performance
Now, I want to emphasize a crucial point here. Server performance can be one of the reasons behind the high load time of your page. Therefore, choosing the right server for your e-commerce website is very crucial.
At ServerGuy, we provide managed and dedicated servers for Magento hosting. You don’t have to worry about an increase in load time of your site due to server performance anymore. We take care of that.
If there is a problem with Magento code, then you or your developer can solve it using PHP Profiler or Magento Debugger
Points to be kept in mind before using Magento Varien:
- Magento debug mode should not be run on live sites as it gives complete info about how your page loads. Therefore, always run it in a development mode.
- When you run code profiler, there will be an additional overhead as you will be initiating the execution of specific commands during loads.
- Using the profiler is very time consuming and requires in-depth technical knowledge. One wrong command can result in a huge problem.
- You must try to solve front-end issues from your side. It helps in confirming the fact that the problem is really on the server-side.
- You can also check if the problem related to your database or not by logging into your MySQL account.
- Run show “process list.’’ If any query related to slow areas stay on the screen, you may have a database performance problem.
- Last but not least, check for faulty network or firewall connections.
How to enable Magento Profiler?
Given below are the steps to enable Magento Profiler:-
1. Log in to your Magento Admin Panel.
2. Go to System and choose Configuration.
3. Click on Magento Developer Toolbar under Advanced Menu.
4. Expand the Debug panel and set Profiler to Yes
5. Click on Save Config button.
6. Open the index.php file in the root folder of Magneto.
7. Search for #Varien_Profiler::enable();
8. Uncomment it by removing #
Varien_Profiler::enable();
What do the Magento Profiler Results mean?
After you are done with all this, you will see the profiler output at the bottom of all Magento pages. It includes the following headers:-
- Code Profiler- Name of the block of the code.
- Time- The amount of time a block of the code took in execution. (in seconds).
- Cnt headers- The number of times it got executed.
- Emalloc- The amount of memory assigned by PHP for this particular action. (in bytes).
- RealMem- The amount of memory being used while rendering a particular Magento page.
What if profiler output is not visible on the store frontend?
Despite enabling the profiler, in some cases the profiled data is not shown on the website pages. You can try doing a quick fix then, it may do the job for you:
Comment out the undermentioned code block in file app/code/core/Mage/Core/Block/Profiler.php
if (!$this→_beforeToHtml() || !Mage::getStoreConfig('dev/debug/profiler') || !Mage::helper('core')→isDevAllowed()) {return ;}
I hope you find this article useful. If you have any questions, queries or feedback, then do not forget to comment below.
You can also request a call from us to know more about Managed hosting for Magento.