July 12, 2020

cm-mini

Thinking Magento

Magento - Site Speed & Performance

The big question that anyone ever asks us about Magento is site speed and performance. The community edition of Magento is and extremely hungry resource hog a lot of the time and performance can suffer if subject to shared hosting, infact most hosting providers will remove a magento site from their servers and ask that it is either placed on a dedicated or virtual private server (VPS).

Being limited by a shared server means you will not be able to make changes to php settings, so this will include memory levels, time out issues and space. The improvements in site speed and performance are therefore recommended for a dedicated or VPS. At our hosting provider, xcache is used on Magento servers to help to improve the compilation of php scripts and places it into the RAM for direct access, reducing page load times. More information can be found here. On top of this the compression of the JS and CSS files is the next line of defence from poor performance. The extension from Fooman called "Fooman Speedster" is easy to install and will compile JS and CSS files that are featured in XML files (not css or js manually inputted into the template) or XML page updates and works in conjunction with the built in Magento cache. More information can be found here.

The final solution in terms of speeding up your store will be to edit the .htaccess file to enable apache html caching of files served. This does sometimes cause problems with updating catalog.xml files for the layout, but it does update to the latest version after a short period of time. However, it's well worth it, as it speeds up store speed by around 75%

The following code can be inserted into the base of your .htaccess

AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/x-javascript application/x-json application/x-httpd-php
AddOutputFilter DEFLATE html xml css js php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
php_flag zlib.output_compression on