But this ad space

Magento 2 Speed Optimization Guide for Better Performance

Photo of author
Written By Henrik Adams

The new era in eCommerce innovation is none other than Magento 2 or M2 for short. It has a lot more features, more complex, and more code lines than the first generation.

Such flexibility level also comes at a price, which is slower. The number issue from store owners as well as developers is the inferior performance. 

For a Magento 2 development company, it has become a priority to speed up performance. By default, the speed of Magento 2 isn’t slow since the default store runs smoothly and is strong.

Most issues in high loading times and slow interface are due to misconduct and lack of knowledge to optimize a website

A Magento development company would agree that when you are not able to meet the basic requirements to run a Magento store, the speed will slow down.

These requirements include not using the right extensions and not enabling the right plugins.

If this is not resolved, your eCommerce store could lose plenty of prospective customers due to slow speed. Fortunately, there are ways to optimize Magento 2 for better performance that could boost Magento development services.

1. Inspect every third-party extension installed.

Programming experts wrote the Magento 2 core, thus there’s little room for improvement in the core code.

Normally, this is not the case for extensions you could download for free or buy. Some could slow down a website.

Consider an audit of your third-party extensions. Turn on and off every module and clear caches and determine if it changes the speed of the website.

Test all front pages, critical page types, product pages, category pages, and checkout.

When you switch off an extension and the site gets faster, then you found the cause. Contact the vendor of the plugin and inform them about the issue in performance. 

To turn off the extension, you would require SSH access. Most hosting firms would let you access a server through SSH and provide the necessary credentials.

When you’re logged in, do this command to disable:

php bin/magento module: disable VendorName_PluginName

Turn it back to run with this:

php bin/magento module:enable VendorName_PluginName

This command checks what modules were enabled or disabled:

php bin/magento module:status

Another way of disabling an extension is to simply delete it from the app/code folder. Follow this:

php bin/magento setup:upgrade

To get it back, simply copy to the app/code and run the same command:

php bin/magento setup:upgrade

Deleting unused extensions from the file system is always good practice since they have the potential to become a security risk. 

2. Opt for the fastest hosting that’s affordable.

The hosting plan of choice plays a critical role in the overall performance of a website.

Magento 2 has particular tech requirements. These are 2G of Ram at a minimum and Solid State Disk at SSD. 

If you are not able to meet the two criteria, then expect no decent speed. Go for a hosting plan like a Servebolt Fast Magento 2 or as much RAM space you could afford.

3. Caching on.

It might surprise you how many times a slow Magento 2 could be resolved by simply enabling cache.

Proceed to the backend menu System > Cache Management, and turn it on by double-checking the setting.

All should be green and would look like this:

Magento2-Cache-Management

A Magento 2 development company could tell you why the cache is off. Some of the reasons include a third-party developer, an in-house designer, or an integrator who forgot to switch it on.

Thus, if all of a sudden the site becomes slow and even unresponsive, check out the cache settings.

4. Turn on the Production Mode. 

M2 has three modules of operation, namely, default, developer, and production. Production is the fastest. For debugging, both the default and developer modes are used. Never use it for a live site though.

The hosting provider could provide you with the SSH access details to determine the mode you’re running. This is the simple command:

php bin/magento deploy:mode:show

Run it within the Magento folder root. The following command sets the production mode:

php bin/magento deploy:mode:set production

It could take some time, depending on the configuration. You’ll see a screen similar to this:

Magento2-Production-Mode

5. Do not use JS Bundling.

A special feature of Magento 2 is JS bundling. It’s meant to cut down several HTTP requests needed to load a page through grouping JS files.

Supposed to be it’s great for performance but apparently not. It makes a huge 5-10MB file with all JS code if activated.

A file that huge impact page load time negatively. A lot of elements on the web page was an issue a few years ago, but all decent web hosts of Magento 2 now should run HTTP2 and SSL.

Before proceeding to the backend menu Stores >Configuration>Advanced>Developer, JS bundling should be off.

Magento2-JS-bundling

The settings are only visible in developer mode with Magento 2.2+

6. CSS/JS Minification enabling.

Another special feature of Magento 2, which was not available in Magento 1. Now you could minify JS/CSS files without a third-party extension.

Proceed to: Stores>Configuration>Advanced>Developer and turn on Minification:

Magento2-JS-minification

The setting works in the production mode alone.

7. In-built Cache, skip the use of Varnish.

Magento 2 by default has a couple of choices for Full Page Cache, namely, built-in app and Varnish. The latter needs installing extra software and managed on a server.

You could choose at Stores>Configuration>Advanced>System (you have to in the developer mode to do a switch on M2.2.2)

Magento2-Cache-Settings

It may not be a good idea to use Varnish. Here’s why:

  • More point of failure. Varnish is third-party software that: requires maintenance, would break, and requires upgrades. 
  • Random Access. Site visitors are able to access random pages, which are not cached at all times. 
  • Difficult with SSL traffic. These days, secure traffic is a must. However, you could face serious hardships when attempting to set up Varnish over SSL. While there may be a workaround, they don’t work all the time. 

Summing up: Tips to Speed up Magento 2

Some may have reservations when it comes to moving to Magento 2. However, it’s clear that the platform was designed for a better experience for customers and admins.

It maintains the flexibility the platform is known for but adds several useful, necessary features. The new version grows as the business grows. 

Experts believe that businesses would make the move towards Magento 2 from either the first version, from other eCommerce platforms, or start a brand-new web store. To keep up, the wealth of available extensions should be upgraded to the new version.

Disclaimer. The views and opinions expressed here are those of the authors. They do not purport to reflect the opinions or views of IdeasPlusBusiness.com. Any content provided by our bloggers or authors is of their opinion and is not intended to malign any organization, company, individual, or anyone or anything.

For questions, inquiries and advert placements on the blog, please send an email to the Editor at ideasplusbusiness[at]gmail[dot]com. You can also follow IdeasPlusBusiness.com on Twitter here and like our page on Facebook here. This website contains affiliate links to some products and services. We may receive a commission for purchases made through these links at no extra cost to you.