Magento13 min read

Magento performance optimisation: 14 ideas that work

By Gianni Lasorella on Tuesday, 7 January, 2025

Magento performance optimisation: 14 ideas that work

In this article

Magento performance optimisation is a key step in preparing your Magento 2 store for success. Faster page load times improve the user experience, resulting in higher conversion rates, revenue, and customer happiness.

Numerous studies have demonstrated the link between these parameters. An average page load time of 2 seconds has a low bounce rate of 9%. However, the bounce rate rises significantly to 38% with an average page load time of 5 seconds.

Despite the knowledge that website speed is critical to customers’ online purchasing experiences, many companies struggle to optimise their stores. This article dives into 14 great optimisation ideas to help you increase the speed of your Magento store, even if you’re not a technical expert.

Magento performance optimisation starts with testing

Testing site speed is the first step in determining how significant the problem is. Your team should run speed tests on a regular basis as part of Magento’s maintenance cycle.

You can evaluate Magento 2 speed with third-party services such as Pingdom Tools, GTmetrix, WebPageTest, or Google PageSpeed Insights. All it takes is entering your Magento store URL and running the tests.

Once you know your website’s speed, it’s time optimise it. Here are industry best practices that are most often recommended for optimising Magento performance.

14 Ideas for Magento performance optimisation that work

1. Upgrade to the latest Magento version

New Magento versions include new features, enhancements, and bug fixes for existing capabilities to improve the user experience. That’s why the first step to accelerating and improving the speed of your Magento website is to upgrade to the most recent version of Magento.

If you’re currently using Magento 1, don’t hesitate to upgrade to Magento 2. It comes with many features that will help you respond to market trends and customer expectations while providing air-tight security.

If you’re not sure where to start when it comes to updating the Magento version of your e-commerce shop, check out this guide or get in touch with us.  Our Magento experts will provide you with migration recommendations based on your unique business needs and current configuration within a reasonable time frame.

2. Enhance your hosting setup

Magento 2 is a feature-rich platform that demands substantial resources. To guarantee that your store performs well and provides a nice customer experience, you need to optimise your hosting environment.

Here’s  a checklist you can use when selecting the best Magento hosting provider:

  • Check for support for your Magento version/edition, including PCI compliance, MySQL 5.6 and above, Apache 2.x/NGINX/Litespeed, and PHP 7.0.
  • Ensure that the server is up to current with the newest software, meets PCI rules, and provides a secure shopping experience for your consumers.
  • Choose a server location close to your target audience for faster response times and a better user experience.
  • Consider storage capacity based on business needs and maintain frequent server backups for data protection.
  • Prioritise robust security measures like firewalls, intrusion detection systems, virus scanning, and DDoS protection.
  • Consider enterprise-grade security solutions, such as frequent debugging, free SSL certificates, and 24-hour support, for prompt security help.
  • Make sure your hosting company offers backups and a mechanism to recover your data if something goes wrong.

These are the minimal criteria you should have from your Magento 2 hosting provider. Steer clear of free or extremely low-cost hosting providers since they cannot guarantee the loading speed, user experience, or security of your e-commerce site.

3. Delete data you don’t need from Magento datalog

Magento 2 keeps product data in Magento Datalog. Remove useless data on products that are no longer available or deleted product reviews to free up disk space and improve the loading time of product pages and search results.

Here’s a solution to clear out your Magento Datalog:

1.     In the Magento Admin Panel, navigate to System > Configuration > Advanced > System, then MySQL Message Queue Cleanup.

2.     Set the values for each attribute.

3.     After you’ve entered all the essential information, click Save Configuration.

4.     In MySQL Message Queue Cleanup, you can either alter or keep the default settings for each attribute.

4. Use a Content Delivery Network (CDN)

A content delivery network (CDN) consists of numerous servers located throughout the world. When customers visit your Magento store, their browser searches nearby CDN servers for content. If it’s available, it speeds up your store’s loading time.

CDN comes in handy for:

  • Stores with a huge consumer base,
  • Stores that serve customers in multiple regions,
  • Stores with a vast number of images, movies, or other multimedia files,
  • Stores with poor page load times or unpredictable performance.

How do you set up a CDN in Magento? Here’s the solution:

In the Admin Panel, go to Stores > Settings > Configuration > General > Web. Adjust the Store View in the upper left area as needed.

Expand the Base URLs section and perform the following steps:

  • Update the **Base URL for Static View Files** to reflect the CDN location where static view files are hosted.
  • Update the **Base URL for User Media scripts** to include the CDN’s JavaScript scripts.

You may leave both fields empty or use the placeholder: {{unsecure_base_url}}.

Next, expand the Base URLs (Secure) section and perform the following steps:

  • Base URLs (Secure) area in Magento 2 settings.
  • Update the **Secure Base URL for Static View Files** to reflect the CDN location where static view files are hosted.
  • Update the URL of the JavaScript files on the CDN to the **Secure Base URL for User Media Files**.

You can leave both fields blank or start them with the placeholder: {{unsecure_base_url}}.

Some hosting companies will supply CDN services as well, but you may also select your own CDN provider based on your requirements and budget.

5. Enable Varnish caching

Adobe suggests enabling Varnish Cache as a practical solution for enhancing Magento 2 speed.

Here’s an easy way on setting up Varnish for Magento:

  • Navigate to Stores > Configurations > Advanced > System > Full Page Cache.
  • Choose Varnish Cache as your chosen caching technique from the dropdown box under Caching Applications.
  • Open the Varnish Configuration section and provide the relevant information.

Next, browse to the Varnish Configuration area and provide the following information:

  • In the **Access list**, specify the IP address or hostname that is permitted to clear the Varnish cache. This field should include your application’s domain name.
  • Define the backend host. If you leave this field blank, the default value will be kept as localhost.
  • Define the Grace time to specify how long Varnish will deliver outdated material in the event of backend unresponsiveness.

Finally, after you’ve finished configuring everything, click the **Save Config** option.

Alternatively, you can use SSH to enable Magento 2 Varnish from the command line. If you prefer this technique, use the command below:

bin/magento

Configuration: set–scope=default–scope-code=0 system/full_page_cache/caching_application 2

6. Use in-memory data stores for caching

In-memory data stores faster data retrieval than Magento’s default cache. They also offer data backup options for recovery in the event of power failures or server restarts. Using these in-memory data stores instead of hard disk storage increases data processing speed through the cache, saving important time for data retrieval from RAM.

Improving data retrieval is critical to satisfying even the most demanding customers. Adobe recommends Redis as an excellent speed caching option for Magento 2 stores. To configure it, follow these steps:

You can find your Redist setup in the files using this command:

 

/etc/redis/redis.conf or /etc/redis/.conf.

 

To configure Redis default caching, use the following command:

bin/magento setup:config:set –cache-backend=redis –cache-backend-redis-server=127.0.0.1 –cache-backend-redis-db=0

If you use Redis for several forms of caching, each database should have a unique number. It’s recommended to use 0 for the default caching database, 1 for the page-caching database, and 2 for the session storage database.

To configure Redis page caching, use the following command:

bin/magento setup:config:set –page-cache=redis –page-cache-redis-server=127.0.0.1 –page-cache-redis-db=1

You can also configure Redis for session storage with the following command:

bin/magento setup:config:set –session-save=redis –session-save-redis-host=127.0.0.1 –session-save-redis-log-level=4 –session-save-redis-db=2

7. Check third-party extensions

Adobe Commerce third-party extensions have the potential to create a variety of challenges, including performance deterioration in your Magento store. As a result, it is critical to keep your third-party extensions up to date with the most recent versions. If you discover any extensions that are causing greater load time, consider using alternatives.

To ensure security, always download or purchase third-party extensions from a reputable source, such as the Commerce Marketplace.

Note: If you have updated Magento to the most recent version, some extensions may no longer be compatible and stop operating properly. To get the required performance improvement, remove any superfluous extensions or upgrade to a version that is compatible with your current Magento version.

Make sure to examine all key CMS pages, including the homepage, categories, goods, and checkout. If you disable a module and observe that your store’s loading time improves, you have effectively fixed another issue that was affecting Magento’s performance negatively.

8. Set up Elasticsearch

Customers are more likely to make a purchase if they can easily and quickly discover the things they want.

Elasticsearch considers a variety of elements to assess the relevancy of search results, including search query phrases, product descriptions, and product ratings. It also offers consumers fast and efficient full-text search capabilities.

 

Starting with Magento 2.4.x, Elasticsearch is pre-enabled with default settings. For previous versions, you can set it by going to Stores > Settings > Configuration > Catalog > Catalog Search, then selecting Elasticsearch as the Search Engine and clicking **Save Config**.

9. Enable flat categories and products

One of the factors that impacts Magento performance is its capacity to load databases. To speed up the process, activate Flat Catalog in the setup. Flat Catalog enables the unloading of database numbers whenever a product is requested to be shown. At the same time, the MySQL query complexity will decrease.

To enable it, go to the backend, Stores > Configuration > Catalog > Catalog > Storefront, and choose Yes in the Use Flat Catalog Category box.

 

10. Enable production mode

First things first, verify the current mode of your Magento by using the following command:

Bin/Magento deploy:mode:show.

Following the **Current application mode** section, you will see information about the current mode of your Magento shop. You’ll see one of these three options: default, developer, and production.

The default and developer modes are used for debugging. Avoid using the default and developer modes on a live website.

Instead, switch to production mode to optimise Magento 2 performance. This includes full-page caching and JavaScript bundling. Production mode is Magento’s quicker mode, around 20% to 30% faster than the development mode.

To enter production mode, run the following command:

Bin/Magento deploy:mode:set production.

If you wish to return to the other two modes, replace production in the above command with either default or development.

11. Optimise your image before uploading

To improve the performance of your Magento 2 store, you must include an image. You should know that one of the primary causes of the overflow page is a picture size that is too large to upload to your website.

So, images should be compressed before you send them. You can use JPEG format for product photos and PNG or SVG for layout and logo. Alternatively, consider using software that compresses your store’s photos automatically.

12. Set index mode to “Update on schedule”

Magento indexers operate in two modes:

  • Update on Save,
  • Update on Schedule.

When changes are made to your catalog or data, the Update on Save mode immediately refreshes it, however it might create delays and temporary data unavailability on your Magento site.

To avoid this problem, switch to Update on Schedule mode by running the following command:

Bin/Magento indexer:set-mode {realtime|schedule} [indexer].

 

To configure the Update on Schedule Indexer mode, select the schedule option. You can provide a list of indexers separated by spaces in indexer, or leave it blank to set all indexers in the same way.

13. Convert your Magento 2 website to PWA

A progressive web app (PWA) is an online app that uses common web technologies like HTML, JavaScript, and CSS but has the functionality of a native mobile app. In short, PWA offers customers an app-like experience.

 

Many well-known companies have already converted their websites to PWAs for a good reason. When you convert your Magento 2 website to a PWA, the pages load two to four times faster, significantly improving the customer experience.

14. Merge CSS and JS files

Another great optimisation idea is to merge and minify CSS and Javascript files, which means making the web page as small as possible so that it loads quickly.

First, set Magento 2 to production mode by running this command:

./bin/magento deploy: mode: set production

Here’s how to merge JavaScript files:

  • Navigate to backend, Stores -> Configuration > Advanced > Developer > JavaScript Settings.
  • Set Merge JavaScript Files to Yes.
  • Set Minify JavaScript Files to Yes.

For CSS files, follow these steps:

  • Navigate to backend, Stores > Configuration > Advanced > Developer > CSS Settings.
  • Set Merge CSS Files to Yes.
  • Set Minify CSS Files to Yes.

When finished, make sure to save your configuration and flush cache to apply the changes.

Wrap up

These 14 best practices open the door to optimising Magento performance, enhancing your store and delighting your customers. Poor Magento performance not only increases the consumer bounce rate but also has an impact on keyword ranks in search engines.

Follow our guide to optimise your Magento site on your own. Implementing all of these ideas, or even just a handful that you haven’t tried previously, can boost your website’s performance.

If you require thorough Magento optimisation services, please contact our team for an expert consultation.

 

Hi! My name is Dion, Account Manager at Hypernode

Want to know more about Hypernode's Managed E-commerce Hosting? Schedule your online meeting.

schedule one-on-one meeting +31 (0) 648362102

Visit Hypernode at