Magento 2 optimization: Steps & tips to make performance faster

Magento 2 optimization is not always an easy task and commercial extensions for this purpose are expensive. That’s why we will provide you some easy steps and tips which can significantly increase your Magento performance.

Magento 2 Optimization Tips

Magento 2 comes as a new era of e-commerce innovation. It provides more features but it is more complex with more lines of code which compared to the first generation of this platform. Please keep your eyes on this post and find the relevant method to speed up the site performance.

1. Turn Caching On

If your website suddenly becomes slow and unresponsive — check cache settings. Go to backend menu System > Cache Management and double-check the settings. It should all be green and look like this:

Magento-2-optimization6

What could the reasons for cache being off? There are some reasons such as a 3rd-party developer, integrator, or in-house designer forgot to turn it on.

2. Never Use JS Bundling

JS bundling is a special function of Magento 2. It is expected to cut down the number of HTTP requests required to load a page by grouping JavaScript files. However, this feature brings more harm than good. If you activate JS bundling it would generate a huge 5-10Mb file with all the Javascript code. A file that big would adversely impact the performance. Many elements on the web page were an issue a few years back, but all decent Magento 2 web hosts should now run SSL and HTTP2.

You can double-check JS bundling is off by moving to backend menu Stores > Configuration > Advanced > Developer:

In Magento 2.2, these settings are only visible in developer mode.

3. Enabling CSS/JS Minification

This is another special feature in version Magento 2. You now can minify JS/CSS files with no need for a 3rd-party module

Move to Stores > Configuration > Advanced > Developer and set minification on:

Magento-2-optimization5

Remember that these settings only work in production mode.

4. Utilize Built-in Cache, Skip Varnish

In the default, Magento 2 comes with two options for Full Page Cache: built-in application and Varnish. The latter needs extra software to be installed and managed on the server.

You can select between the two at Stores > Configuration > Advanced > System ( on M2.2.2 you need to be in developer mode to make a change):

Magento-2-optimization4

You should not use Varnish. I will show you three reasons why you should avoid it:

  1. An additional point of failure: A varnish is a 3rd-party software that will need maintenance and upgrade
  2. Not so easy with SSL traffic: Secure traffic is a must-have nowadays but you might face serious problems when trying to set up Varnish over SSL. There are workarounds but they don’t always work.
  3. Random access: visitors can access random pages that are not always cached.

5. Content Delivery Network

Content Delivery Network (CDN) is a special system that can connect all cache servers. Along with supported geographical proximity, CDN will assist the delivering web content and improve the page loading.

You can follow this guide to set up CDN for Magento 2 website. Move to the backend, Stores -> Configuration > General > Web > Base URLs (Secure)

Magento-2-optimization3

6.  Enable Flat Categories and Products

One of the elements having a great influence on the speed of Magento 2 optimization is the ability of database loading. In the configuration, you can enable Flat Catalog to speed up that. Flat Catalog helps to offload the number of the database once there is any request for showcasing the product. At the same time, the MySQL query complexity will be decreased

Move to the backend, Stores > Configuration > Catalog > Catalog > Storefront, select Yes in Use Flat Catalog Category field.

Magento-2-optimization2

7. Fully Optimized Images

A Magento 2 website often includes a ton of high-resolution images. While these are good for business, the huge file size enhances the overall page size, with a proportional dad impact on the download time. Thus, optimizing and decreasing image size is an important way of the overall store-level Magento 2 optimization. The main points in optimizing the images are:

  • Compress the images (use a tool to batch-compress the images).
  • The logo of your website should be in PNG or SVG format.
  • Product images should be in JPEG format.

8. Memcached or Redis

Memcached is a free and open-source distributed memory object caching system that improves Magento 2 optimization by reducing the load on the native database. Since the configuration process is a bit long.

Choosing for either Redis or Memcached integrates a high-speed backend cache with full cache tag support and no need for additional low-level file system cache because both of them are the distributed memory caches that speed up Magento 2 large-scale web applications with dynamic databases. Therefore, particularly on the high traffic Magento 2 website, the performance is excellent and stable.

8. 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: *;

9. Reduce Server Response Time

With Magento 2 Built-in cache function, your website’s response time is quite good with nearly 0.5s. But it is not an ideal time as Google expects. For that reason, Magento 2 offers Full Page Cache via Varnish natively. You can set up Varnish to get the first byte around 0.1-0.2s.

Move to the backend, Stores > Configuration > Advanced > System > Full Page Cache, transfer Caching Application to Varnish Cache.

Magento-2-optimization1

Open the Varnish Configuration section, Finnish the settings:

Magento-2-optimization

10. Clean Up Magento Database & Logs

Cleaning up Magento Database & Logs is one of the important steps for Magento 2 optimization. In the default, Magento 2 keeps the logs for 180 days. For an average store, this could lead to a huge data volume that quickly overloads the database. You can set up Magento 2 to maintain logs for a shorter duration and cut down the clutter in the database.

11. Monitor Website Performance

Website’s performance should be measured on a regular basis. This is an essential aspect since it helps you to find out what impact your website loading times, how new modules or plug-ins perform, what can be improved, etc. There are a lot of free performance monitoring solutions available on the market. The page speed can be checked with the help of such tools as GTMetrixPingdomUptrends, and many others.

12. Run The Latest Magento 2 Version

And the last but not least, it’s crucial to make sure you have the latest Magento 2 version installed. New releases offer better function fixed bugs, and, most crucially, performance enhancement. So, update your installation regularly to gain higher speed and optimized performance. Besides, you can checkout extensions by Magesolution can help optimize Magento 2 store:

  • Optimize Magento 2 Performance with Instant Search
  • Optimize Magento 2 Performance with Ajax cart
  • Improved Layered Navigation

These seven Magento performance optimization tips will make your online store fast. It will attract more potential customers. You can refer to our delicate performance optimization service to have direct support from the enthusiastic team.

Conclusion

The strategies and recommendations given above will give your Magento business the performance boost it needs to increase its market share. The store will be able to provide a greatly enhanced user experience, which will increase client happiness. Your company will experience tremendous growth in terms of sales and market traction as a consequence. If you are struggling with your current Magento version, you should opt for our Magento Performance Optimization Services. Contact us for more information!