Optimizing Magento 2 for Performances

Optimizing Magento 2 for Performances

Optimizing Magento 2 for Performance: Best Practices and Tips.

In this article, we address the important topic of performance optimization on Magento 2, providing a series of useful tips to improve the website's loading speed.

Improving the performance of the Magento 2 site is essential not only to ensure an optimal browsing experience for users, but also because loading speed is one of Google's ranking factors and can have a significant impact on the site's position in search results. Additionally, a fast site can help increase the crawl budget, i.e., the number of pages that Google will crawl and index in its search engine.


Setting the Correct Application Mode

Magento offers three operational modes:

  • Default mode
  • Developer mode
  • Production mode

Neither Default mode nor Developer mode are optimized for performance and the production environment.

Designed to facilitate code writing and debugging, Developer mode should not be used in a production environment in any way.

Even Default mode, intended as a starting point for site development, should not be used in production as it is not specifically optimized for performance.

The only Magento application mode capable of ensuring the best performance is Production mode, and it is important to verify that the site operates in this mode when deployed in a production environment.

Using a Performance-Optimized Theme

Luma, Magento's default theme, is not optimized for performance.

While it is possible to optimize them to a certain extent for speed, sites based on Luma are not capable of achieving satisfactory Core Web Vitals (CWV) scores.

The poor performance of Luma has thus led many developers to use alternative front-end solutions.

Among these solutions is Hyvä Themes, which has established itself as one of the most popular and accredited options for Magento.

The significantly reduced page weight and the reduction in the number of network requests required to load a page, which are characteristic of Hyvä, make these themes a solution capable of ensuring the best possible performance and Core Web Vitals.

Upgrading Magento Version

Keeping the site updated with the latest version of Magento is fundamental to ensure both the security and performance of the site.

In addition to offering increased security, bug fixes, and new features, each new version of Magento also includes performance improvements.

Here are some of the most important performance improvements introduced in version 2.4.6, the latest version of Magento at the time of the publication of this article:

  • Support for the latest version of PHP, 8.2, which can provide over 20% faster and more efficient code execution compared to PHP 7.3
  • Improvements to the Redis caching system that contribute to further reducing page loading times and improving site responsiveness
  • Native support for WebP image format that allows reducing the size of image files and improving page loading times.

Upgrading Magento to a newer version is a complex process that involves both the back-end and front-end of the site.

On the back-end side, the upgrade process requires migrating the site's data, installing the new version of Magento, and upgrading the third-party modules and extensions used on the website.

On the front-end side, upgrading Magento may require making changes to the design and structure of the site, to be compatible with the new version of Magento. When upgrading a Magento site to a later version, front-end misalignment issues may arise for several reasons:

  • Layout changes: Magento may have modified the basic layout of the website in the new version, causing problems with existing themes and extensions that rely on the previous layout.
  • Custom code: The website may have custom code that is no longer compatible with the new version of Magento, causing problems on the front end of the site.
  • Extension compatibility issues: Third-party extensions and themes may not be compatible with the new version of Magento, causing problems on the front end of the site.

It is also important to note that upgrading Magento often requires an upgrade of the hosting environment as well. Each new version of Magento requires certain technical and system specifications to function correctly; therefore, it is important to ensure that the hosting environment is compatible with the version of Magento being used.

Using Advanced Caching Techniques

Magento offers various caching solutions to improve site performance. Below are the three main caching solutions supported by Magento:

  • File system

    The file system is the default caching storage option that requires no configuration. Despite its ease of use, file system caching is less optimized for performance compared to other caching solutions.

  • Database

    Although generally more performant than file system storage, this caching technique can overload the database with implications for scalability and availability.

  • Redis

    As a data storage system in memory, Redis provides superior data writing and reading performance compared to disk-based storage or traditional database systems. This feature makes Redis the ideal caching solution for high-performance sites.

    It is recommended to use Redis both for the default cache and for the Full Page Cache (FPC). Consideration can also be given to using Redis for session data.

  • Varnish

    Varnish is a high-performance HTTP cache server that can significantly improve the performance of a Magento site. Recommended by Adobe, it can be used as a caching application for Magento's Full Page Cache. Functioning as a reverse cache layer, Varnish stores HTML pages generated by Magento and delivers them directly to visitors, reducing the site's response time. This results in faster loading times, a better user experience, and reduced load on the Magento server. Using Varnish as a caching solution can therefore lead to overall improved performance for a Magento site. Varnish can also be used in combination with Redis to further optimize the performance of a Magento site. While Varnish takes care of caching the site's pages, Redis can be configured to store and manage session data. This combined approach leverages the caching capabilities of both solutions to offer optimal performance.

Setting the Correct Reindexing Mode

Indexing is the method of organizing data within the database used by Magento to improve query performance and speed up data retrieval.

The list of Magento indexes can be consulted at this link

Magento contemplates two modes of updating indexes:

  • Update on Save
  • Update on Schedule

The Reindex on Save option involves updating indexes in real time whenever a change is made to the database. This option, which involves rebuilding the index in the face of each change to the database, entails significant use of computational resources and is not optimized for performance.

Unlike Update on Save, the Update on Schedule for indexes does not involve constant execution of reindexing queries, but the rebuilding of indexes occurs at predefined intervals. By minimizing the impact on system resources and ensuring better site performance, the use of this mode is especially recommended for e-commerce with large catalogs and high traffic volumes.

Minifying CSS and JavaScript

Minifying CSS and JavaScript files is another important action to improve website performance, as it reduces file size and speeds up page loading times. Reducing the size of CSS and JavaScript files indeed accelerates page loading times and contributes to improving the Core Web Vitals.

Using a CDN for Static Content

To improve site performance, including page loading times and Core Web Vitals metrics, consider using a CDN for static content, such as images, CSS files, and JavaScript files.

A Content Delivery Network like Cloudflare also offers various security features that can help protect the site from bots and cyber threats.

Optimizing Images

Image optimization is another important aspect for improving the performance of a Magento website and can be achieved using various solutions.

One possible solution is the use of image optimization services such as Cloudflare Image Optimization, which uses compression and caching techniques to provide optimized images and reduce page loading times.

Alternatively, specific Magento optimization modules can be used, offering similar image compression features, such as WebP Images by Magefan. This module allows for automatic conversion of images into the WebP format, which is a highly compressed and web-optimized image format.

In both cases, the goal is to improve the performance of the Magento website, particularly regarding page loading times and the improvement of Core Web Vitals, which are performance indicators that measure user experience on the site.

Performant Hosting Environment

Using a performant hosting platform for Magento 2 is essential to ensure optimal site performance and to achieve Core Web Vitals.

The minimum configuration of a Magento 2 server can vary depending on the specific needs of the website and the traffic it must handle.

However, to ensure adequate performance, it is advisable to use a hardware configuration with the following minimum specifications:

  • Processor: at least 8 physical cores
  • RAM: at least 128GB of RAM
  • Disk: 2 960GB NVMe SSDs

NVMe SSDs can read and write data at much higher speeds than SATA or SAS SSDs. This means that, if the server uses NVMe SSDs, the time required to load data from the disk will be reduced, which can translate into improved website performance.

Using Performance Monitoring Tools

Using performance monitoring tools such as New Relic or Blackfire can help identify performance issues and optimize the site accordingly.


Speeding up a Magento e-commerce site requires a strategy that involves multiple aspects of the site, from back-end to front-end. To maintain a fast and reliable Magento website over time, it is important to constantly monitor and optimize the site's performance.

Beyond site performance, it is equally important to pay attention to the overall user experience of the site. An appealing design, intuitive navigation, easy usability, and an optimal mobile experience are indeed crucial factors for creating a positive user experience and can positively influence the conversion rate of sales.

Our agency, Adobe Solution Partner with certified Magento developers, possesses the skills and experience to optimize a Magento site for performance.

Contact us now for a free quote.

Optimizing a Magento 2 Site for Performance

Increase your eCommerce sales with a performant site.

Trust an Official Hyvä Magento Solution Partner.

Contact Us