Table of Contents
Magento performance optimization is significant for every web store owner based on this platform. The website configuration directly influences the UX and can attract or repel customers. Online stores with poor performance and slow pages can’t be ranked high in search results. Consequently, your competitors with more optimized sites will leave you far behind.
In this article, we share the most effective Magento optimization tips that will help you achieve better performance and speed up the work of your online store. Note that we’ve asked our in-house Magento developers to comment on the tips and share the ideas, so there will be no fine words and optimized images. Only the real-life developers’ thoughts and relevant screenshots. Let’s go!
Today, in e-commerce website management, the page loading speed is given special attention. This metric would be hard to underestimate: according to statistics, 40% of Internet users claim to abandon a website if it takes more than 3 seconds to load, while 47% of users say they wouldn’t wait more than 2 seconds!
In e-commerce, time literally means money: as users won’t wait long for a page of a web store to load, having a slow website means losing customers and, subsequently, income. That is why Magento 2 page speed optimization is essential. But not just the speed – the overall performance dramatically impacts the customers’ decision to purchase from a web store. The statistics show the shopping cart abandonment rate if customers use a desktop version of a web store is more than 70%. In the case of mobile shopping, the figures go beyond 80%.
As 63% of all online shopping orders in 2023 were generated using smartphones, it is crucial to pay attention to Magento site performance optimization for mobile devices as well.
No doubt, Magento is one of the most flexible, scalable, and customizable e-commerce CMS widely used: currently, there are more than 130,000 live Magento-based websites, which makes Magento one of the top 5 most popular e-commerce platforms.
However, web store owners sometimes notice that no matter how much effort they put into making the user experience even more satisfying, the sales decrease, or new customers do not arrive at the website. Of course, the problem may be in the products’ catalog or the prices, but it is necessary to check everything. As we already know, customers may need help with technical problems, including slow page loading or errors during the ordering process.
We suggest two simple steps to get an idea about your website speed and evaluate if you need professional Magento performance optimization services.
Once the test is over, you can evaluate the results. Normally, the indicators should be marked green. If they are marked orange or red, it shows the problems with the loading speed.
It is necessary to pay attention to the so-called “web vitals” – meaningful metrics that help to measure and evaluate your website performance. These metrics include:
These indicators are checked by the Google page experience algorithm, so the better the performance, the better for the website’s SEO.
We’ve scanned a product page of a Magento-based website that belongs to one of the world-famous brands to provide you with a better understanding of how this Google tool can help you in the performance evaluation:
As you can see, the desktop version of the website doesn't demonstrate particular issues; only the Time to First Byte could be improved (below, we'll tell you why this metric matters).
However, everything changes if we switch to the mobile version:
The assessment failed, and several indicators need substantial improvement.
2. The second step on the way to Magento 2 performance optimization is to check the server response time. You can do it by evaluating the Time To First Byte (TTFB) metric which indicates the exact moment when the server sends your browser the very first byte. It is recommended to have this indicator of 0.8 seconds or less. TTFB is important as it helps to understand whether the performance issues are server-originated.
To assess the TTFB of your Magento website, you can use the Chrome developer console. For that:
You’ll observe the time of the request sent, the waiting time (exactly what we need, the TTFB), and the content download time.
These can be the initial stages of detecting Magento performance issues. Below, we will discover what Magento speed optimization steps you can follow. If you face problems with the metrics mentioned above, it is already a good sign to search for a qualified Magento speed optimization service provider.
When it comes to Magento 2 optimization, there are various strategies you can follow to make your website run faster. Below, we will consider the most effective Magento 2 optimization techniques and provide comments from our in-house Magento developers.
First, let’s see what options for Magento performance optimization are offered out-of-box.
Stores →Configuration→System→Full Page Cache
In this case, you can select between the built-in cache and the Varnish cache:
With the built-in cache everything is clear; Varnish cache is an HTTP accelerator that was created to serve content-heavy dynamic websites and sites with APIs.
This option is marked as “recommended” as Varnish cache is considered more productive than the built-in cache. That is why enabling and configuring the Varnish cache on the server and enabling it on Magento is important.
NEKLO expert comments:
“When discussing the Varnish cache option, we recommend installing any cache warmer available on the market. This tool "warms up" the cache for specific pages, pushing Magento to create more cache. How does it help to speed up Magento? Varnish cache is periodically cleared, and it may happen that a customer will have to wait for the web page with no cache to load. It is better to have the cache "warmed up" so the customers will not have to wait.
How can we improve Magento’s performance? The first thing we do when providing the Magento performance optimization service is checking the cache. We pay special attention to the layout cache, configuration cache, full page cache, and block cache. They should all be enabled. Important note: the production mode should also be enabled – it is mandatory requirement.
In addition to the Varnish, we also recommend installing Redis – a cache solution that can be used as a PHP session storage. It stores metadata and cache records in one file, allowing the number of inodes and other operations to be reduced.”
Stores →Configuration→Developer→JavaScript Settings
4. Move JS code to the bottom of the page – this option is your opportunity to move the JS files from the header to the footer, allowing the HTML content to load first. Thus, your users will be able to interact with the website’s content while the JavaScript will be executed.
Stores →Configuration→Developer→CSS Settings
Why are there 2 files instead of just one? Basically, that’s because Magento has 2 CSS file styles: m.css (basic, mobile styles) and l.css (desktop styles).
Stores →Configuration→System→Images upload configuration
This section allows to set up the maximum width and height of the image, enables resizing, and, most significantly, sets up the image quality.
NEKLO expert comments:
“Various developers suggest optimizing images, especially for Magento. However, it is necessary to remember that Magento works well with images. It allows storing the image in its original size and converting it into a small, medium, large, and thumbnail version. These options will fill the product catalog with quality images and not slow down the website.
Kind reminder: for website administrators, it would be nice to remember not to overload Magento with excessively “heavy” media files.”
For Magento server optimization purposes, you can use a content delivery network.
NEKLO expert comments:
“The use of a CDN is not a must for Magento 2 speed optimization. However, it is recommended for large online stores wishing to work outside their local market. The principle of CDN work is easy: when the users enter your website, they need to get the whole data volume from the website loaded as quickly as possible. It will not take much time if they are located close to your web store server. But the bigger the distance between the users and the server, the slower the load speed. That is why, if you want your web store to be easily available from various parts of the world, we would suggest using the CDN as it allows you to store the website content on the servers that are closer to the users.”
Adobe releases new Magento versions once every three months. Each new edition comes with major and minor new features and security patch update. When upgrading your Magento to the latest version, together with new functions, you get a chance to get rid of bugs that can impact Magento speed.
The latest released version as of December 2023 is Magento 2.4.7. However, if your website has any customizations functioning incorrectly, you may face serious difficulties upgrading to the most recent version. In this case, we would suggest not wasting time trying to fix the issues on your own and turning directly to a qualified Magento optimization service provider.
A very similar point is using the latest version of PHP. The current stable one is PHP 8.3.0. As with the Magento updates, every new PHP edition helps resolve the issues the previous one couldn’t, improving the overall website performance.
How to optimize the Magento database? There are several tactics to approach Magento 2 database optimization. The most effective include disabling flat catalogs, passing to ElasticSearch, clearing database logs, and arranging the indexers.
For years, switching to flat catalogs has been the way to collect the product attributes in a more or less simple table. This has been considered a method to avoid multiple database queries.
However, starting from Magento 2.1.x, this technique does not work anymore. It is no longer recommended to use flat catalogs. On the contrary, it is confirmed that this method can lead to performance degradation and other issues.
Magento officially warns you:
2. Use ElasticSearch/Open Search as a catalog search engine
One of the reasons for Magento to slow down is its inability to search and process large data volumes when the wrong search engines are used. In this case, you can opt for ElasticSearch (which is actually a must for Magento 2.4 and up) or Open Search.
Both solutions will help enhance search accuracy and, subsequently, speed up your Magento website.
3. Cleaning database logs
Too many database logs can become a problem. They create a real mess occupying more and more space on your disk and slowing down the website.
That’s why deleting the database logs is considered a way to speed up Magento backend: you need to go to the PHP MyAdmin Panel in your hosting solution and try clearing the tables with the logs like these:
4. Arranging the indexers
Magento needs indexers to avoid long MySQL queries every time some specific data is necessary. Indexers help to get data for the request from a table containing the required results.
However, disordered indexers can badly impact Magento’s performance. We would suggest the following tips:
For Magento 1, updating the indexers can be executed right from the Admin panel. For Magento 2, in the root directory, it is necessary to execute the following command:
Php bin/magento indexer : reindex
If you have your own indexers, you can set up your reindex rules and the indexer will be updated independently.
NEKLO expert comments:
“There is a working tool helping optimize the Magento backend – New Relic. It is a paid solution, but it definitely is worth the price. This tool allows you to see all the website loads in real time. It helps you observe what pages were loaded, what requests were made, what Ajax calls were made, how many times, etc.
And remember: tools will only do some of the developer's work. They can help automate some processes, detect issues, and suggest ways to resolve them, but the central part of the work for backend optimization is done manually.
That's why make sure to control that:
To show its best, Magento needs a powerful hosting solution able to cope with high loads and many customers. The better the hosting capacity is, the more users will have an opportunity to visit your website simultaneously without delays. The customers’ requests will not remain in a queue, and your web store will run faster.
Don’t forget to check if your hosting solution meets the Magento system requirements. As your web store grows, update the hosting accordingly.
The core Magento 2 code doesn’t offer much room for improvement. But this usually doesn't apply to the third-party extensions and modules you can buy or download for free. Some of them can significantly slow down the site.
Audit third-party extensions. Turn each module on and off, clear the cache, and see if the site speed changes. Test all essential page types: home page, category, product, and checkout pages. If you turn off the extension and your site is faster, congratulations – you've found your performance bottleneck and can resolve it.
Today, more than 90% of customers shop from mobile devices. Progressive web applications (PWA) were created specifically for mobile clients and represent a combination of a website and a native mobile application. For users, it means they can open the site in a mobile browser and save it as an application on their smartphones, bypassing the Google App or App Store. The website will visually look like an application, opening in full screen. The additional PWA benefits include the ability to send push notifications and use the solution even without the Internet.
This technology can help to optimize the speed of a Magento website. However, building a website on PWA requires more time and is more expensive than many think. In our experience, development on PWA takes three times longer than traditional Magento, even if Magento offers its PWA Studio and supports the tech development. The reason is the novelty of the technology itself.
So why would we still recommend to start adopting PWA?
Firstly, PWA will speed up your website – this is guaranteed. Gaining one second, or even a millisecond, is what modern e-commerce strives for every day. Speed, as you have already understood, is very important for customer experience and, as a result, for conversion rates. PWA is close to native technologies; it pulls information from the user’s phone – location, first name, last name, etc. The application can take this data so that the user only partially fills out the checkout. As a result, the user can place an order in just one click or even without an Internet connection.
Secondly, PWA is a headless architecture. Independent work of the front end and back end allows you to carry out technical work on the site without interrupting the shopping process. You can even replace the backend engine; users will not notice the change.
Thirdly, the PWA update’s peculiarity is that, unlike native applications, approval from Google Play or the Apple Store is unnecessary. A typical mobile app must pass a Google Play or Apple Store technical review to trigger an update. This approval takes days, or even weeks. Plus, the update is often sent back for revision.
NEKLO expert comments:
“Today, another powerful solution is gaining popularity – the Hyva Arsenal theme for Magento 2 development. It works fast, and it has been created with optimization in mind. This solution can even be considered as a competitor to GraphQL.
It is not a free theme, but by paying for it, you get access to the сlient chats in Slack and GitHub, where you can observe all the tasks in progress and all the live updates available. Moreover, they provide continuous tech support and announce every planned upgrade.
Working on projects with the Hyva theme is not just delivering tasks – it is the way to learn something new and track the Magento development progress in real-time.”
The request for Magento performance optimization has always been and will probably remain popular among e-commerce business owners. Naturally, we also don’t support the idea of wasting an hour to get from a product page to payment options.
We hope the methods we've overviewed will allow you to accelerate your Magento 2 website to supersonic speed, increase your Google PageSpeed scores, rank your site higher in search results, and grow your business. But if you still have questions regarding Magento development, contact NEKLO – together, we will resolve any issue.