Optimizing Magento 2 for Speed

Eric Hileman

June 8, 2021
Optimizing Magento 2 for Speed

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, MageMojo has learned—and taught a lot—about how to optimize server performance for Magento 2. Their STRATUS MaaS platform represents the state-of-the-art when it comes to 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.

MageMojo 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 used 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.” The 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 improving speed, but sometimes the merging of CSS can present display issues on the front end 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 you should consider when optimizing Magento 2 for faster page rendering. For more information or assistance with optimizing your Magento 2 installation, please refer to our Knowledge Base articles.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Ready to get Started?

Sign up now
0
Would love your thoughts, please comment.x
()
x