Speed and good performance are central to the success of any eCommerce store. Unfortunately, even Magento 2 , which is the latest version of the current market leader among open-source e-commerce platforms, very robust and highly scalable, still keeps its users somehow annoyed by this timing issue.

The speed of a site is not only important for the shop owners, it’s important for all internet users. Faster sites mean happy users, happy customers, and more sales. If a Magento 2 shop responds slowly, customers leave the website and maybe buy products at your competitor.

If you have a Magento 2 site, the following tips can help you speed up your site.

1. Server Requirement & Configuration

The Server environment is the base for the highest performance. If your server doesn’t function properly, your website speed will never be optimum no matter what you do. While you choose a host, always :

  • Go for a dedicated server or VPN. A shared hosting option is a strict NO for Magento.
  • Deliver nearly instant server response times for catalog browsing
  • Check your Magento 2 system requirements to ensure that you are using the one required by Magento 2

2. Optimize Images

An eCommerce store is full of images and banners for obvious reasons. To make sure that the images aren’t affecting your site’s performance, optimize them accordingly. The image size that is too heavy to upload on your site is one of the crucial reasons for the overload page. Thus, compressing should be done before submitting an image. You can use JPEG format for Product images, and PNG or SVG for the layout as well as the logo.

Enable Compression

Follow the resources to enable compression by Google’s offer. Let’s change nginx compression directives from: gzip_types: text/plain application/x-javascript text/javascript text/xml text/css image/x-icon image/bmp image/png image/gif; to gzip_types: *;

3. Enable Flat Categories and Products

One of the aspects having a great influence on the speed of Magento 2 performance is the ability of database loading. To fasten the read speed of the database you should enable Flat Catalog. This will minify the number of database joins done when showing products and due to that the MySQL query complexity will be reduced.

Login in backend , and go to Stores > Configuration > Catalog > Catalog > Storefront, choose Yes in Use Flat Catalog Category field.

4. Optimize JS and CSS files

CSS and JS files are used to make your frontend look attractive but at the same time adversely affect the speed of your site. If you are using Magento 2, fortunately, you have a way to tackle this without compromising the fancy display of your site. You can merge JS and CSS files to increase the speed of your Magento 2 site.

Please put Magento 2 into production mode.

./bin/magento deploy:mode:set production 

Javascript Files

Login in the backend, and go to Stores -> Configuration > Advanced > Developer > JavaScript Settings

  • Set Merge JavaScript Files to Yes.
  • Set Minify JavaScript Files to Yes

CSS Files

Login in the backend, and go to Stores > Configuration > Advanced > Developer > CSS Settings

  • Set Merge CSS Files to Yes.
  • Set Minify CSS Files to Yes

5. Content Delivery Network

Content Delivery Network (CDN) is a special system that can connect all cache servers. In addition to supported geographical proximity, CDN will take over the delivering web content and fasten the page loading. Please follow this guide to set up CDN for Magento 2 stores

Login in the backend, and go to Stores -> Configuration > General > Web > Base URLs (Secure)

input your HTTPS CDN URLs in here and let your customers enjoy fast loading speed.

6. Caching

Do not forget to update your store. Magento team is constantly working hard on improvements of performance, so don’t miss out on any!


We hope you find these tips about speed optimization in Magento 2 helpful. Feel free to share this article or leave a comment below. Your opinion is much appreciated!

Tags: speed magento2