Codeias is used to treat mild-to-moderate types of development pain.
Using Magento Profiler to Speed up Magento Performance
As developers already know, Magento is a powerful tool for online eCommerce because it is well supported and has a wealth of features to choose from. However, performance drop-off is not uncommon as a result of the way in the which the installation ages. Magento is not alone with this, but there is a powerful developer feature to help developers overcome this issue.
Introducing Magento’s Varien Profiler
The Varien Profiler is able to identify intricate blocks of code, and establish which ones are used in the loading of a slow page, and how long it takes each block to complete its task. The Profiler is an invaluable tool to assist in finding the points in your system configuration where slow down is occurring the most.
As brilliant as this solution sounds however, it does have some technical limitations. It is not, for example, able to be run on live sites as it can risk exposing intimate details about how your system is configured. Secondly, are additional overheads to be considered when running the system with the profiler switched on, as it will be logging the execution of commands during loads.
How is the Profiler installed?
To turn the “Profiler” on you have to do two things:
- Login to your Magento admin, go to “System > Configuration > Advanced > Developer > Debug > Profiler > Yes“
- Open your root index.php file of your Magento installation then look for commented “Varien_Profiler::enable();” part and uncomment it. If there is no “Varien_Profiler::enable();” then place it somewhere before
- “Mage::run($mageRunCode, $mageRunType);”
Once you are successful at turning on “Profiler” you will see the output in the footer area of any Magento page. It will show the table with following headers:
- Code Profiler – the name of the block of code being executed
- Time – The time it took to complete in seconds
- Cnt – Short for Count, represents the number of times this individual block ran to generate the output
- Emalloc – The amount of memory PHP assigned to this single operation, Its a mix of core PHP memory_get_usage() function without true parameter passed to it, minus timer values
- RealMem – The actual amount of memory used to perform the operation. It is final value is also obtained trough memory_get_usage(true) function minus timer values but this time with true parameter passed in.
The information the Profiler provides, will allow you to de-bug and fix problems to produce a fast loading website once again, and leave your clients happy and satisfied as always.
But first, a warning;
Magento is very resource intensive, and using the Profiler requires a fairly time consuming amount of analysis, so make sure you are barking up the right tree before proceeding with this.
- Make sure your problems are not related to your database. Login to MysQL. Run show “process list”, as you go browse through the slow areas of the site. If any queries stay on the screen as you watch, you probably have a database performance problem.
- Finally, make sure your problem is not a networking relating issue, such as a slow or faulty internet connection, or firewall.
The Magento Varien Profiler is a sight for the sore eyes of developers looking to do away with slow loading pages for website of all sizes.
Struggling with Magento web development?
Codeias are an experienced white-label website design and development agency, we work with agencies around the UK to help with their web development issues.
We stay up to date with the latest trends and technical changes so whatever issue you are having, our team will be able to help.
If you are struggling with Magento web development and would like some expert advice from our team contact us by calling 01257 758078.