Optimizing Magento 2 for Speed

It’s no secret that speed counts in today’s Internet. Google has made...
by Martin Pachol | February 1, 2022

It’s no secret that speed counts in today’s Internet. Google has made it quite clear that the faster web pages render, the better it is for a website’s rankings.

For a Magento 2 website, there are three areas to focus on to increase overall render times:

  • Server hosting
  • Indexing and caching
  • Theme features


If a Magento store can master all three, they are in a prime position to capitalize on ranking performance.

Server Hosting for Magento 2

As the leading Magento hosting provider in the world, Webscale Stratus has learned—and taught a lot—about how to optimize server performance for Magento 2. The Webscale Stratus platform represents state-of-the-art scalable, cloud hosting.

The ideal server hosting environment requires much more than simply piling on RAM and CPUs; to make Magento literally pop onto a visitor’s screen, the hosting must be a fine-tuned combination of server hardware, content delivery network (CDN), caching, and network throughput.

While dedicated servers can actually deliver a stellar performance, cloud-based hosting enables Magento stores to receive the greater network bandwidth and when needed, auto-scaling to meet sudden spikes in traffic. Furthermore, cloud hosting keeps overall costs in check as merchants only pay for the actual services used, whereas dedicated servers must be fully paid for, whether or not they are fully utilized.

Webscale has created the only fully automatic scaling Magento-focused hosting platform. It took us several years and millions of dollars in research and development to arrive at such a level of performance.

Improve Speed with Indexing and Caching Tweaks

Magento uses indexes heavily to optimize database performance. The re-indexing can truly bog down a Magento store if not configured correctly. Indexing mode should be set to “Update by Schedule” instead of “Update on Save.” This allows indexing to run during the regular cron schedule, whereas if indexing occurs whenever a related record is saved, the re-indexing can truly stack up and impede store efficiency.

Beginning with Magento 2.1, enabling flat catalogs is not recommended as a best practice.

As for the cache, all caches should be enabled. With Magento 2, Varnish FPC should be enabled rather than the built-in full page cache. Redis cache should be used for both caching and for sessions. We highly recommend that no store use their database for storing session information.

Purge Database Tables

Several Magento tables can get quite large over time, which can affect database performance. By periodically purging larger tables, you can reduce database indexing routines and speed lookups.

One table you should attend to is the quotes table. This table contains a record of every shopping cart created, whether or not it converted to a completed sale. By purging unconverted carts older than, say, 60 days, you can greatly downsize this table.

Log tables created by various extensions and add-ons should be likewise purged from time to time. One common table we often find that needs pruning is the mageplaza_smtp_log table.

Theme Features

Magento themes come in all shapes and sizes. At first glance, it’s difficult to figure out which ones are truly fast and which ones are not. If you’re shopping for a theme try running their demo site through Google Lighthouse to identify any potential problems. The most common are those that prevent early rendering of the page.

One of the pitfalls you should be aware of is when you turn CSS Merging on in your store’s backend. Merging CSS and JavaScript is very useful to improve speed, but sometimes the merging of CSS can present display issues on the frontend of a Magento store. The merging of JavaScript can sometimes be problematic with certain extensions.

If you find that your theme is hindering your speed, do not be afraid to consider another theme. The loss in revenue from poor rankings can far outweigh the cost of a new theme.

These are a few of the most important considerations when optimizing Magento 2 for faster page rendering. For more information or assistance with optimizing your Magento 2 installation, please refer to our Documentation articles.

Popular posts

by Jose Kunnappally | August 22, 2022

Ecommerce Holiday Shopping 2022: What to Expect and...

by Jose Kunnappally | April 18, 2022

The Global Ecommerce Security Report 2022

by Jose Kunnappally | January 12, 2022

How a CDN can boost your Core Web...

by PAUL BRISCOE | January 11, 2022

3 Ways to Write Better Caching Modules in...

Stay up to date with Webscale
by signing up for our blog subscription

Recent Posts

by Daniel Bartholomew | September 25, 2023

Supercharging LLMs with Supercloud

Supercloud, characterized by a decentralized and distributed architecture, has the potential to revolutionize cloud computing. This paradigm shift could have far-reaching implications for Large Language Models (LLMs), such as ChatGPT,...
by Daniel Bartholomew | August 27, 2023

Key Kubernetes and Edge Trends to Watch

Daniel Bartholomew, Webscale's Chief Product Officer, has shared his insights on four noteworthy trends to monitor within the realms of Kubernetes, container orchestration, and the expanding landscape of edge computing....
by Daniel Bartholomew | July 31, 2023

Prometheus Querying – Breaking Down PromQL

Prometheus has its own language specifically dedicated to queries called PromQL. It is a powerful functional expression language, which lets you filter with Prometheus’ multi-dimensional time-series labels. The result of each...