If your Magento store has more than 1000 products and experiences slow loading, which can potentially cost you thousands of dollars in cart abandonment, you might want to take a proper look into whether your Magento site is optimized. In this tutorial we have compiled a list of top 11 tips to optimize your Magento store to make sure that your website is running at its fastest speed, which in turn provides incredible results for sales, rankings, and user experience.
1. Optimize Magento store by choosing fast web hosting
It is of the most importance to choose a good web host before even trying to optimize your Magento store. A good web host must satisfy the following conditions: high security standards, high speed connection, and quick support.
For Magento, a dedicated server is required. Stay away from cheap shared hosting.
2. Optimize Magento store by setting up Content Delivery Network (CDN)
The end purpose of implementing a Content Delivery Network (CDN) is to improve users’ experience. A CDN is a system of distributed servers that deliver web content to users from multiple locations. For example, if the origin is in California, and the user is in London, this user can download content from the nearest local server in Europe instead of reaching long distance from the North America server.
3. Optimize Magento store by optimizing images
High quality images are often used on Magento stores to encourage user’s engagement. However, heavy images can lower your site’s loading speed and therefore you need to compress them before uploading on your site.
Lossless compression can reduce the file size up to 70% without compromising its quality. Tools like compressor.io, kraken.io, or the “Save for Web” function in Photoshop can also help you achieve this purpose. A number of extensions are also available on magentocommerce for you to consider.
4. Optimize Magento store by uninstalling unnecessary extensions
Modules can be disabled in backend by going to “Stores” -> “Configuration” -> “Advanced” -> “Advanced”. After disabling modules of choice, click “Save Config” to see a change in your site loading speed.
5. Optimize Magento store by cleaning Magento logs
Log cleaning feature is disabled by default in Magento backend. Logs about frequently read pages, frequently compared products, or best sellers are kept for 180 days before being deleted by the system itself. Over time, this amount of information can be a burden in your Magento database.
The easiest way to manage your logs is to change saved log days. This can be done following this path: “Stores” -> “Configuration” -> “Advanced” -> “System” -> “Log”. Choose a desired number for your “Save Log, Days” to determine how long Magento should keep your logs. Choose “Yes” for “Enable Log Cleaning”. Click “Save Config” to save your changes.
6. Optimize Magento store by updating to the latest Magento version
Updates come with fixed bugs, improved security and performance. There are some notes that you take before updating your Magento site:
- Check the release notes to see the latest version of Magento. You can see it either under the navigation bar or in your inbox in the Admin Panel.
- Always backup your data, in case the update goes wrong.
- Update your site when there is the least traffic to avoid glitch or confusion.
You can update Magento using the Connect manager readily available in backend. To do so, click on “System”, choose “Magento Connect”, and click “Magento Connect Manager”. Fill in your credentials to start the updating process.
7. Optimize Magento store by utilizing cache
Your site loading speed is boosted by Magento cache system. There are several types of cache that can be individually enabled or disabled. Go to “System” and click on “Cache Management” in order to see a list of options, choose your desired ones, and click “Submit”. A combination of APC + Varnish + NGINX + Memcache has been preferred with great success.
Enable gzip compression
Gzip compresses your users’ requested pages before sending them to the browsers, and thus results in shorter loading time. According to GTmetrix, gzip compression should be on the top of your Magento optimization checklist.
To enable Apache gzip compression:
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
To enable NGINX gzip compression:
gzip_buffers 16 8k;
For your users’ sake, you can leverage your browser’s caching to determine how long images, JS, and CSS should be stored locally in web browsers. Browser caching will help your site load faster because browsers have to download less data, and thus give your users an easier time navigating through site pages. Copy and paste these lines into your .htaccess:
## EXPIRES CACHING ##
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 2 days”
## EXPIRES CACHING ##
In case mod_expires is not enabled, mod_headers is your option.
## Add default Expires header
ExpiresDefault “access plus 1 year”
Full page caching using external extensions
You can also look for Magento full page caching extensions for a quick optimization options.
8. Optimize Magento store by using Flat Catalog
Customer and product data is typically stored in Magento using the entity – attribute – value model (EAV). These data require a number of tables, and thus complex MySQL queries need to be responded. Flat catalog will reduce the complication, putting these data into one table.
Flat catalog can be easily enabled in backend: “Stores” -> “Configuration” -> “Catalog”. Choose “Yes” for “Use Flat Catalog Category” and “Use Flat Catalog Product”. Click on “Save Config” to save the changes you just made.
Cache update will be prompted at this point. Click “Cache Management” link provided, and choose “Flush Magento Cache” to refresh the cache.
9. Optimize Magento store by tuning MySQL server
Every time a Magento webpage is loaded, the database server must work on a series of queries. These queries are handled on an individual basis, with data fetched from the disk, processed, and finally returned to the user. Slow disk access happens, making webpages slow to load.
MySQL provides query_cache_size – a configuration command that tells the server to store query’s result in memory, instead of fetching it all the way from disk. The size you can set for this cache depends on how much memory your MySQL server can handle.
A recommended setting for your my.cnf is as followed:
query_cache_type = 1
query_cache_size = 32M
10. Optimize Magento store by manually reindexing data
Indexing is the default mechanism of Magento to ensure that your store works fast (together with the use of Flat Catalog). As the data for, for example, prices, change, Magento must reindex these data so it can be displayed on your website. Without indexing, Magento will have to calculate the price of every single product while being dependent on many other price-affecting factors (discounts, wholesales, etc.), thus loading price can be slow, which is very much likely resulting in shopping cart abandonment.
Indexes help speed up MySQL queries. In order to manually index your data, follow this path in the Magento admin panel: “System” -> “Index Management” -> “Reindex Data” (after ticking all the data you want updated) -> “Submit”.
11. Optimize Magento store by merging Javacript/CSS files
To merge JS/CSS, follow this path in the Magento admin panel:
“System” -> “Advanced” -> “Developer”.