Magento is a highly complex CMS system being feature rich and full of functions. Therefore, it always loads slowly due to various reasons. If we optimize its performance, we can improve user experiences and rankings too.
An Imaginative Scenario of Shopping Experiences
Suppose you own a brick-and-mortar store selling a large number of products in different sections. One prospective customer enters the storefront, and none is available to greet her. Anyhow she finds a navigation map of the store and starts heading towards a section where her intended products have placed.
Unfortunately, no signage or labels have placed on the doors of the sections, and she has to look into the each section of the store to know which products have in it. With frustrations and rigorous search, she reaches her final destination and sees the ranks of products she wishes to buy.
The Dismal scenario is not ending here too. She found no sales person to attend her, and she has to rely on self-service. Anyway, she picks items up and loads into her cart trolley. She arrives at checkout point and waiting for long to accomplish payment.
After coming out from your store, she takes a sigh of relief and posts a status on her Facebook account indicating her fans and friends that how worst shopping experiences she encountered in your store.
Do you like it? Never, as no business wants to spoil the reputation in the market. The same is true for online storefront too. If you left your store at the mercy of a lazy webmaster and attendance as support service point, you are likely to lose a lot of sales. If you storefront design and programming is of inferior quality and missing end-user experiences in each approach, no guarantee of success for you.
Magento a King of E-commerce Platforms
To start an ecommerce store on the web, we have numerous choices in terms of technologies, platforms, and frameworks. Magento is open source platform built on PHP programming language and offers feature rich store to do big scale online businesses.
Magento has inherent characteristics to provide your shopper the excellent shopping experiences by integrating myriads of extensions to extend the features and functionality of storefront.
Moreover, Magento provides a plenty of store optimization tools for UX optimization, performance optimization, search engine optimization, conversion optimization, and much more in the line.
Today we may embark upon performance optimization and gain some useful tips to win the fiercely competitive market.
There are some tips that can apply for any version of Magento since those are applicable for clients/browsers in most cases, such as:
The default .htaccess file includes several opportunities to improve the performance of Magento. You can enable or disable them to grab benefits.
1. Disabling ETags
By functionality, ETags force browsers to validate cached page content on each visit. However, it is good for security reasons but can hamper servers in some cases. Therefore, disabling them improve performance.
## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags FileETag none
2. Enabling Expires Headers
Expires headers define the lifespan of cached page content. We know that loading images and multimedia content frequently gulps the performance. Therefore, enabling expires headers for all components and extending it further for comments and images can help you in performance optimization.
<ifModule mod_expires.c> ExpiresActive On ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> ExpiresDefault "access plus 1 year" </FilesMatch> </ifModule>
3. Enabling Compression of Output
Compression of static and dynamic content in output can cut the load time significantly, and Magento developer can do it by activation Apache mod-default module and compress static content before reaching to the browser.
Since, Magento is generating dynamic content like other CMSs, creating .user.ini file in the document root folder of Magento site by enabling output compression. You can do it directly or use plugins for it.
For Static Content:
For Dynamic Content:
zlib.output_compression = on
After finishing the entire development process, you can apply these administrative tips.
Navigate to System > Configuration > Developer
Similarly, apply YES for Merge CSS file option in CSS Settings.
Now, clear the cache or flush it.
5. Enabling Flat Catalog
Magento applies EAV model for data storage such as product data and customer data. Unfortunately, it upgrades the extensibility at the cost of prolonging SQL queries, hence the performance.
The Flat Catalog, as it name suggests, flatten the data. It merges category and product data into one table and improves the performance. Thereby, in the admin panel, you can enable flat catalog option for categories and products if you have more than 1K products in the Magento store.
Navigate to System > Configuration > Catalog
Under Frontend, click YES to Flat Catalog Category option in the drop-down.
Similarly, apply YES for Flat Catalog Product option.
6. Full Page Cache
Full page caching improves the load performance and cut the load on the server. Therefore, using a reliable and quality extension for full page cache improves your Magento performance.
By practice, we have seen that combining several 3rd party caching solutions brings great performance through caching. For instance, NGINX + APC + Memcached + Varnish
7. Enabling Memcached
Memcached provides general purpose admin memory caching facility that cuts the number of times an external database or API read in RAM. You can enable Memcached functionality by:
Navigate to Magento folder/app/etc/local.xml
Now, open the file local.xml find
<cache> <backend> memcached</backend> <!-- apc / memcached / empty=file --> <memcached> <!-- memcached cache backend related config --> <servers> <!-- any number of server nodes can be included --> <server> <host> <![CDATA[127.0.0.1]]> </host> <port> <![CDATA]> </port> <persistent> <![CDATA]> </persistent> </server> </servers> <compression> <![CDATA]> </compression> <cache_dir> <![CDATA]> </cache_dir> <hashed_directory_level> <![CDATA]> </hashed_directory_level> <hashed_directory_umask> <![CDATA]> </hashed_directory_umask> <file_name_prefix> <![CDATA]> </file_name_prefix> </memcached> </cache>
8. Updating Indexes
We know Magento is a complicated system to deal with it. It allows developers to work with the enormous quantity of data and that makes it slow in the loading process. To overcome it, managing indexes can improve performance.
Technically, indexes provide extra database tables to allow rapid nod from the database. However, core system is updating indexes on each occasion of object storage it may fail and required manual attempts to update indexes. You can use the command line to re-index the indexes if it causes issues.
9. Cleaning Database
Unfortunately, Magento has yet not a sustainable database, and it needs to clean up logs regularly because it keeps logs up to 180 days. It results into a heap of logs in the database.
Therefore, cleaning the logs in the database at two-week intervals may improve performance booster. Therefore, developers should practices database cleaning process regularly in Magento. Of course, as a precaution, you can take backup of the database on your system or the Cloud.
Navigate to System > Configuration > Advanced > System > log
Change under Save Log Days to 14 days, and save the configuration.
10. Using CDN
The content delivery network enables your Magento to deliver key content like product data, images, CSS, and JS from multiple locations to cut the load on a single hosting server. At present, KeyCDN like CDN services enables Magento stores to leverage N capabilities with simple integrations.
11. Image Optimization
We know images are inevitable parts of online stores as we are unable to provide touch experiences for the products we sell on Magento. For a single product, multiple images taken from different angles are mandatory and also need to provide zoom facilities.
Moreover, mobile-friendly websites have to offer retina ready image optimization solutions where good resolutions for an image is vital. In due course, only the latest tools for image optimization for PNG or JPEG like image formats are not enough. Instead, we should look at SVG like vector based image formats that enable us to scale the images at any level without missing performance.
Highly optimized images can reduce loading time considerably.
12. Enabling Compilation
Built-in compilation feature of Magento can boost performance to a greater extent. However, application files in Magento searched in a particular fashion in each page load, and that requires lots of file system reads. When you enable compiler from Magento admin, you can cut these file system reads considerably because it is copying all files in a single include directory and caching when it used the most.
Navigate to System > Tools > Compilation
Click on Run Compilation Process button.
13. Choosing Better Hosting Services
Today we have better options to select the best hosting at premium rates so why should we go for risky shared hosting for our medium to large Magento store? If you can afford VPS or dedicated servers, it is far better. Otherwise, cloud hosting is affordable for scalability and performance where public cloud hosting is paralleled VPS or dedicated servers of web hosting.
14. Cutting Number of Extensions & Modules
The more extensions you have on your Magento store, your hosting server has to face more HTTP requests and load of extra CSS & JS files. Therefore, don’t run for each new extension entering the market, but keep only required ones which are essential for your store performance. If you have installed more than necessary, try to disable them instead of uninstalling all.
Navigate to System > Configuration > Advanced > Advanced
Change under Modules to Disable for your selected extensions, and save the configuration.
Now, come to know how complicated Magento is at performance optimization. The given tips are not enough to achieve performance completely. We need to take help of seasoned Magento developers who can analyze your store completely and can prescribe the steps for optimization.
About The Author:
I am tarang Vyas, head of development team at Perception System, a leading Magento development company.