February 04, 2022
Magento 2 speed optimization

Magento 2 optimization isn’t complicated. But before you improve your site speed, you need to know why it’s slow.

Start with a review of your server configuration. As a CPU-bound application, Magento 2 needs high processing power. You can use Adobe’s equation to estimate the web nodes/cores required to optimize Magento 2 performance.

Besides hosting, using the wrong operation mode can slow Magento considerably. Other reasons for poor store performance include using a heavy theme or overusing third-party Magento extensions.

In general, common issues with Magento 2 performance include:

  1. Inadequate hosting.
  2. Incorrect operation mode.
  3. Poorly configured caching.
  4. Bloated theme or excessive extension use.

We’ll address these and more in the Magento 2 performance optimization tips below.

Magento 2 Speed Optimization

1. Reduce the initial server response time.
2. Use Varnish caching.
3. Use Redis.
4. Optimize the Magento 2 database.
5. Use Production Mode.
6. Optimize your store theme and media.
7. Minimize third-party extensions.
8. Avoid using a Flat Catalog.

1. Reduce the Initial Server Response Time

Time to First Byte (TTFB) is a metric that indicates the time needed by your server to deliver the first byte of data to a device. You can check your website’s TTFB using the Google PageSpeed Insights tool. If it’s more than 600ms, it’s concerning.

So how do you reduce initial response time in Magento? One way is to host your store on servers near your customers. But this isn’t always possible or feasible.

Another way is to choose a hosting provider that offers a complementary Content Delivery Network (CDN) to help you reduce the server response times. This approach will help with your Magento 2 PageSpeed optimization while letting you serve a global audience.

Nexcess managed hosting plans come with a built-in Edge CDN powered by Cloudflare.

2. Use Varnish Caching

Magento 2 performance optimization with Varnish

Magento users often misunderstand its caching system. This confusion results in merchants using its default caching system, whereas Magento 2 is designed to use Varnish for full-page caching.

Varnish is an open-source HTTP accelerator that can reduce your page load time to as little as one second. It acts as a reverse proxy and caches static content like images, CSS, and JavaScript files.

It reduces the requests handled by Magento and improves response times. Here’s Adobe’s guide on Varnish configuration to improve Magento website performance.

3. Use Redis

Another highly effective Magento 2 speed optimization technique is using Redis for session cache management. Redis is an in-memory data store perfect for caching bulky PHP session files and replacing the default cache.

Redis can handle over 60,000 connections and 50,000 queries per second. It can improve content delivery, reduce loading time, and boost Magento speed by freeing up your database and filesystem.

You can install Redis on your web server and follow our guide to configure Redis for Magento 2 performance optimization.

4. Optimize the Magento 2 Database

Magento’s reliable performance is one of the reasons why global giants like Walmart and P&G use Magento 2.

The Magento database rarely bottlenecks performance. It only becomes a problem when it consumes more resources than PHP.

New relic for Magento 2 speed optimization

You can use a free tool like MySQLTuner or a freemium one such as New Relic for Magento 2 performance monitoring to identify and fix issues.

MySQLTuner gives you insights into 300+ metrics, including table_cache and table_open_cache, crucial for performance optimization. It even provides suggestions based on past performance to improve Magento’s performance.

5. Use Production Mode

Another way to speed up Magento is to use the correct operating mode. This is the easiest Magento 2 speed optimization tip on our list.

Magento 2 has four default modes:

  1. Default mode.
  2. Developer mode.
  3. Production mode.
  4. Maintenance mode.

And if you’re wondering which mode is faster in Magento 2? The Production mode is the fastest because static view files are generated in advance and served from the cache.

You can refer to Adobe’s documentation to check and change the Magento operating mode.

6. Optimize Your Store Theme and Media

Bloated themes can hurt Magento’s performance and user experience with excessive requests and bulky JS files, especially during checkout.

If you haven’t optimized images on your store, they can also increase the webpage size and hurt website loading times.

In such cases, store owners often use extensions to help with Magento 2 image optimization, advanced JS bundling, performance tuning, lazy loading, and to minify CSS files.

These measures might mask the underlying issues, but they won’t solve them. To improve your site’s speed, use themes made by experienced Magento developers.

You can use free image optimization tools like ResizeImage.net to resize and compress media before uploading it to your Magento website. Optionally, you can serve WebP images to compatible browsers using an optimizer extension.

7. Minimize Third-Party Extensions

A third-party extension can help you leverage Magento’s modularity for functionality. But when used excessively, it can hurt website performance.

You can optimize your HTML and JavaScript settings, merge CSS files, and optimize images to improve loading speed. But, poorly coded extensions will hurt your Magento 2 speed optimization efforts.

The best way to overcome this is to use plugins sparingly and download them from the Magento Marketplace. Adobe implements rigorous quality checks to ensure the extensions on their marketplace don’t compromise website speed and security.

8. Avoid Using a Flat Catalog

If you’re using Magento version 2.1.x or above, you shouldn’t use a Flat Catalog for Magento speed optimization. Using it can lead to performance degradation due to an increased load on your site database and long-running cron jobs.

Magento 2 speed optimization flat catalogs

Before you disable Flat Catalogs, make sure none of your extensions use them. You can disable Flat Catalog for Magento 2 from the backend admin panel using these steps:

  1. Navigate to Stores > Settings > Configuration > Catalog > Catalog.
  2. Expand the Storefront section and update the values for Use Flat Catalog Category and User Flat Catalog Product to No.

Final Thoughts: Magento 2 Speed Optimization

We hope our Magento 2 speed optimization steps help you optimize your Magento store.

Besides our speed optimization techniques, you can also use a cache warmer, HTTP/2, CSS-JS minification, and increase browser cache TTL.

If you can’t be bothered with Magento optimization, you should switch to Managed Magento hosting with Nexcess. Our plans include Varnish, PHP 7+, an integrated CDN, and image compression for top-tier performance.

Take advantage of our complimentary free Magento site migrations and switch to Nexcess today.

Maddy Osman
Maddy Osman

Maddy Osman is a WordPress expert, WordCamp US speaker, bestselling author, and the Founder and SEO Content Strategist at The Blogsmith. She has a B.A. in Marketing from the University of Iowa and is a WordCamp Denver organizer while also operating The Blogsmith, an SEO content agency for B2B tech companies that works with clients like HubSpot, Automattic, and Sprout Social. Learn more about The Blogsmith's process and get in touch to talk content strategy: www.TheBlogsmith.com

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.