Categories Tutorials

How to Speed Up Your Magento eCommerce Site

Magento is a very popular and feature rich open source e-commerce web application. Magento is fully customizable and ready to meet the user’s requirements, allowing them to create and launch a fully functional online store in minutes. Magento is known as a ‘heavy’ eCommerce solution and if not set up properly, it can be slow. Most of the CMS or eCommerce platforms like Magento and WooCommerce have issues with speed and their performance is degrading over time. In this tutorial, we will share some tips and tricks on how you can improve the performance of your Magento based eCommerce store.

1. Get better hosting

Most of the time, no matter how many configurations and tweaks you do, your Magento site will still be slow if you don’t use quality hosting services. Make sure that your hosting provider supports Magento and knows what they are doing. Ask them to optimize your server for you. Always choose SSD servers. Get a more powerful VPS with more RAM.

Get a VPS from us and we’ll properly set up and configure your server and Magento site for ultimate performance, for free!

2. Some server tweaks you can do

We will list possible solutions for high Magento performance:

2. Keep your Magento up to date

While frequently needing to update the software can be annoying to some users, it is very important to always run the latest version available. Not only will you get more features and bug/security fixes, but with every update, Magento performs better.

To ensure that hackers are unable to use known threats against your site, it is important to always be running the latest version.

3. Enable flat data products and categories

Log in to Magento admin back-end, go to System >> Configuration, select Catalog from the Catalog menu >> Frontend. Set “Use Flat Catalog Category” and “Use Flat Catalog Product” to “Yes“.

4. Merge (minify) CSS and Javascript files

The following settings will merge (minify) the CSS and Javascript files, which in turn will help minimize the http requests, making the response time even faster:

Go to System > Configuration, Advanced > Developer > JavaScript Settings. Set “Merge Javascript” Files Files to “Yes”

Go to System > Configuration, Advanced > Developer > CSS Settings. Set “Merge CSS” Files to “Yes”

Don’t forget to clear the cache after you are done.

5. Leverage browser caching

Browsers can cache files for faster access. You can take advantage of it to lower start render time.

Configuration depends on your server:

5.1 Leverage browser caching for NGINX

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 365d;
add_header Pragma public;
add_header Cache-Control "public";

5.2 Leverage browser caching for Apache

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"

6. Gzip compression

Enabling GZIP compression in APACHE or your webserver can reduce the size of HTML, CSS, and JavaScript files sent over the network.

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  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/x-javascript
  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/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

7. Image optimization

Optimizing images is a must for any kind of website you have. If you optimize your images properly, you won’t use any quality, but you will get better performance. Properly optimized images can drastically improve the loading time of your website. The less time a browser needs to download images the better. You can compress them before uploading them using a tool like Photoshop or there are a number of extensions you can use to auto-optimize them (TinyPNG Extension, Smush.it, Compressor Extension, etc.)

8. CDN

Content Delivery Network (CDN) is a web service for hosting your Magento’s external resources: CSS/JS files, images, fonts etc. It aims to serve those files a lot faster than you can with your own server.

  • Use CloudFlare with HTTP/2 support (HTTP/2 is asynchronous protocol which will improve the loading time)
  • CloudFlare can also combine JS and CSS

9. Optimize the MySQL server

MySQL has its own “query cache” that helps generate dynamic pages and content while incredibly improving the performance. This “query cache” works according to the process below. First, MySQL stores the query text & results and then when the same question is requested, the results are served quickly. These are some recommended settings for your my.cnf file.

query_cache_type = 1
query_cache_size = 32M

And also a recommended setting for php.ini.

php_value memory_limit 128M

10. Enable compilation

In the Magento Admin navigate to top right and click System>Tools>Compilation and Enable it.

11. Caching

Magento caches pages into the file system. You can expect a big performance improvement for an average Magento website with Magento caching enabled.

Navigate to System>Cache Management then select all cache types. Click the actions drop down (Top right) and select ‘Enable’. Click Submit.


There’s a few other tweaks and settings you can do to speed up your Magento, but they highly depend on your server, site config and a few other factors. Get a Magento VPS from us, contact us, and our expert Linux admins will carefully analyze your server and website and they will do all the necessary tweaks and settings to get the ultimate performance from your Magento. You don’t have to do any of this if you have a VPS from us. Our EPIC 24/7 Support will do it for you.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

View Comments

  • This is very helpful! Magento is a heavy one. Optimizing the speed of a Magento Site is essential in user experience.