Web Analytics

Fill the form & Get Installation Support

Magento 2 Performance Optimization – A complete guide for your Magento store

 

As per Benchmark Testing, that makes the comparison between out-of-the-box supported and recommended configurations for Magento 2.0 which proved that Magento 2.0 is considered as the greater platform than Magento 1.x keeping in mind all metrics and use cases. Magento 2.0 will never disappoint you when you talk about a result.

  • Per hour orders process up to 39%
  • For catalog browsing, delivery nearly instant server response times.
  • 66% faster add-to-cart server response times.
  • Up to 51% faster end-to-end checkout times.

Now, it’s time to understand How Magento 2 Performance is optimized?

A normal Ecommerce page takes more than 3 seconds to load a product page. Now think for a minute that your customer can be annoyed if he needs to browse through five similar pages on your website? Indeed they will never be patient to wait for the delay. Hence keep the below steps in mind to give them the best experience of your site.

Magento 2 Performance Optimization Step-by-step:

  • Step 1: Enable Flat Categories and Products
  • Step 2: Merge CSS and JS Files
  • Step 3: Content Delivery Network
  • Step 4: Caching
  • Step 5: Image Optimization
  • Step 6: Enable Compression
  • Step 7: Reduce Server Response Time
  • Step 8: Magento Updates

Before following all steps, let us give you bonus advice in advance.

First, check your website score in Google PageSpeed Tools

Magento store speed score via Google Page Speed Checker

If your score is low, make it high by following Google guidelines.

Step 1: Enable Flat Categories and Products

Magento 2 has created a great influence by its ability of database loading. In the configuration, you need to enable Flat Catalog to speed up that. Flat Catalog allows offloading the number of the database once there is any request for showing the product. Parallelly, the MySQL query complexity will reduce.

Now, Go to backend, Stores > Configuration > Catalog > Catalog > Storefront,
Choose Yes in Use Flat Catalog Category field.

Enable Flat Categories

Step 2: Merge CSS and JS Files

In this step, you need to follow is merging and minifying CSS and Javascript files, which means making the web page as light as possible for the fast loading that puts Magento 2 into production mode.

Javascript File

Go to backend, Stores -> Configuration > Advanced > Developer > JavaScript Settings

Set Merge JavaScript Files to Yes

Set Minify JavaScript Files to Yes

Minify JavaScript Files

CSS File

Go to backend, Stores > Configuration > Advanced > Developer > CSS Settings

Set Merge CSS Files to Yes

Set Minify CSS Files to Yes

Minify CSS Files

When finished, click on Save Config and flush cache to activate the change.

Step 3: Content Delivery Network

Content Delivery Network (CDN) is a special system that can connect all cache servers also it also supports geographical proximity by taking over the delivering web content and fasten the page loading.

Follow our guide to set up CDN for Magento 2 stores.

Go to backend, Stores -> Configuration > General > Web > Base URLs (Secure)

set up CDN for Magento 2 stores

Step 4: Caching

In the backend go to the System > Cache Management.

Cache Management

Here, you will find plenty of caching options to flush your Magento 2 cache.

Click on Enable and then submit the options which you want.

Step 5: Image Optimization

The image plays an important factor to make your Magento 2 store’s performance more vivid. However, uploading the heavy size image on your site is one of the crucial reasons for the overload page. So, you have to compress the image before submitting any image. Using a JPEG format for Product images, and PNG or SVG for the layout as well as the logo is the best solution.

Step 6: Enable Compression

Follow below resources to enable compression by Google’s offer.

Now 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: *;

Step 7: Reduce Server Response Time

Your site’s response time is quite good with approximately 0.5s all thanks to Magento 2 built-in cache functionality. But as Google expects it is not the ideal time. Due to that, Magento 2 provides support to Full Page Cache via Varnish natively.

Now, let’s set up Varnish to get the first byte around 0.1-0.2s.

Go to backend, Stores > Configuration > Advanced > System > Full Page Cache,

Transfer Caching Application to Varnish Cache.

Transfer Caching Application

Open the Varnish Configuration section, complete the settings:

Varnish Configuration

Step 8: Magento Updates

Remember to update your Magento 2 store. Mage monkeys team will try their best to help you optimize the site performance.

The result after updating your store from older version to latest version.

Page Insights Magento stores

Performance Toolkit (Optional)

Installation

jMeter:

– go to http://jmeter.apache.org/download_jmeter.cgi and download jMeter in Binary section (pay you the attention that Java 6 or later is required) – unzip the archive

Plugins (only if you want to additional reports (like graphs)):

– go to http://jmeter-plugins.org/downloads/all/ and download JMeterPlugins-Standard and JMeterPlugins-Extras

– unzip them to the appropriate ext directory of your jMeter instance.

– Additional reports can now be added via GUI.

Usage

Before running the jMeter tests for the first time, you will need to first use bin/Magento setup:performance:generate-fixtures command to generate the test data.

Run via console

Example:

Run via GUI

Open jMeter/bin directory and run jmeter.bat

Click in menu File -> Open (Ctrl+O) and select file; or drag and drop benchmark.jmx file in opened GUI.

On the first tab ‘Test Toolkit’ you can change ‘User Defined variables’ like as , , , , .

For running script click “Start” (green arrow in the top menu).

Results of running (Report types)

When you run via GUI you can see the result of working in the left panel. Choose the corresponding report.

After running the script via console report will be created in the path that has been specified.

Threads

jMeter script consists of five threads. Setup thread and four user threads.

The percentage ratio between threads is as follows:

  • 62% browsing, adding items to the cart, and abandon cart (BrowsAddToCart suffix in reports)
  • Only Browsing is 30% (BrowsAddToCart suffix in reports)
  • 4% Browsing of adding items to cart and checkout it as guest (GuestChkt suffix in reports)
  • 4% Browsing of adding items to cart and checkout as registered customer (CustomerChkt suffix in reports)

Magento 2 Performance Optimization Tools:

If you are looking for professional shortcut tools to cut down the performance time conveniently, Mage Monkeys is happy to introduce one useful extension for both Magento 1 & 2 stores.

Fill the form below if you want us to optimize your Magento 2 performance.





    Recent Articles

    Author Info

    Author Image

    Eshika Is a bibliophile and conversationalist. Her life revolves around writing , photography, presentation and repeat. "go with the Flow" is her approach in life.

    Get a Free Quote





      /* second popup */

      CONTACT US (FREE 25 HOURS DEVELOPMENT)

      (We Operate Globally)