[wd_asp id=1]

5 Unmissable Tips to Speed Up Magento 2

Magento 2 (M2) is the next generation of a well-known e-Commerce platform. It’s a highly customisable solution to power online stores. The price you pay for that level of flexibility is always performance.

Magento 2 can be slow. Forums and community boards tend to have people complaining about the poor page load times, so our top tips to speed up Magento 2 will help.

We all know that site speed matters to SEO. So, in order to have better search rankings we have to make sure our Magento 2 store runs as fast as possible. Of course, you can hire expert programmers to speed up your site. But, what if you don’t have the budget for it?

Don’t worry! In this article, five field-proven ways will be revealed so you can increase your Magento 2 performance, with no programming skills required!

5 tips to speed up Magento 2

  • Remove slow third-party extensions
  • Switch on production mode
  • Get more CPU and RAM
  • Disable JS bundling
  • Set Varnish as full-page caching application

1. Remove third-party extensions

Based on experience, most custom extensions make Magento 2 slow. A fresh copy of M2 runs pretty fast with approximately a half-second page load time. But things start to look bad when you add third-party extensions.

A drop in performance is no surprise when third-party extensions are thrown into the mix. Magento 2 is written by experts, while custom extensions are coded by amateur programmers at most. With average skills and no appreciation for performance, Magento 2 will slow down massively.

You need to identify and eliminate extensions that slow your store down. Firstly, get a list of all custom extensions. Go to Magento’s backend menu – go to: Stores > Configuration > Advanced > Advanced.

Tips to Speed Up Magento 2 - Tillison Consulting

These are all the installed extensions. You have to ignore those that start with Magento_ as those are the core extensions. Write down the remaining ones.

Now that you have the list of third-party modules, you then need to disable them one by one and benchmark the page speed. To disable an extension, you need to SSH (Connect via Secure Shell) to the server. You can obtain SSH credentials from your hosting support team. Once you have done this, go to Magento root folder and run this command:

php bin/magento module:disable Extension_Name

It will disable Extension_Name and you can benchmark the page load time. If the speed stays the same, proceed to the next plugin.

To switch an extension back on run:

php bin/magento module:enable Extension_Name

Once you have identified the slow modules, contact its vendor and let them know the problem. You might want to find an alternative or remove them completely.

2. Switch on production mode

Magento 2 has three running modes: default, developer and production. The latter is the fastest one. If your store is slow, chances are your developer left it in developer mode. You need to make sure you are always in production.

To find out what mode you are in now, SSH to the Magento root folder and run:

php bin/magento deploy:mode:show

To switch to production mode run:

php bin/magento deploy:mode:set production

This command might take approximately 2-5 mins. It compiles code and deploys static content. You will see a screen like this:

Tips to Speed Up Magento 2 - Tillison Consulting

While the command is running, your store will be inaccessible as it will be in a maintenance mode.

3. Get more CPU and RAM

Magento 2 needs a powerful hosting to run fast – you can’t expect decent performance from a cheap shared monthly plan.

There is a simple trick to find out whether hosting resources are enough for M2. To do this:

  1. Install a fresh copy of Magento 2 (the same version) on the same hosting that your live site is running on
  2. Benchmark the fresh M2 speed against the live site
  3. Is the fresh copy significantly faster? Then your hosting is OK and the performance problem lies within the live site’s codebase
  4. Is the fresh copy as slow as your live site? Then you need to either upgrade or change a hosting plan

If this test shows you need a new hosting plan check out servers that are optimised for Magento. They are more expensive, but you get the performance boost you wouldn’t have gotten otherwise.

4. Disable JS bundling

This optimisation trick relates to a Magento 2 bug – with JS bundling feature on JavaScript file has an enormous size of 5-10 Mb. JS Bundling can make site take forever to load, especially on slow networks and mobile devices.

Turn off JS bundling to keep page size to a minimum. Go to Magento 2 back-end menu Stores > Configuration > Advanced > Developer and set Enable Javascript Bundling to No.

Tips to Speed Up Magento 2 - Tillison Consulting

5. Set Varnish as a full-page caching application

Varnish is a special software to serve and cache content. It makes sites insanely fast. Magento 2 supports Varnish natively – so, you should take advantage of it. Here is a diagram of M2 + Varnish setup.

Tips to Speed Up Magento 2 - Tillison Consulting

The tricky part here is to get Varnish installed on the server. Your hosting support team should help you with that. In most cases it will be just a package installation, so it won’t be too complicated for the hosting support team to install it.

Next, you need to set Varnish as a Full Page Caching Application. Go to backend menu Stores > Configuration > Advanced > System and set Caching Application to Varnish Cache.

Tips to Speed Up Magento 2 - Tillison Consulting

Once it’s done, Varnish should accept incoming requests and either query Magento 2 or serve cached content. Page load time with Varnish can be as low as 100-200 ms.

About the author: Konstantin Gerasimov is a Magento-Certified Developer with Goivvy.com. He specialises in Magento backend development, performance optimisation and extensions development.

Want to know how to properly handle your sold-out products and maintain your eCommerce store’s SEO? Click here for our comprehensive guide to managing your Magento SEO for out of stock products!

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this article

In this blog, we delve into the intricacies of CRO, offering invaluable insights to marketers and business owners alike. Join...
In a world where consumers and businesses are evolving to be ever more digital (95% of startups already have digital...
Navigating the digital world can be both exciting and difficult for website owners. Web hosting is one of the important...