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:
- Inadequate hosting.
- Incorrect operation mode.
- Poorly configured caching.
- Bloated theme or excessive extension use.
We’ll address these and more in the Magento 2 performance optimization tips below.
Magento 2 Speed Optimization
Reduce the initial server response time.
Use Varnish caching.
Optimize the Magento 2 database.
Use Production Mode.
Optimize your store theme and media.
Minimize third-party extensions.
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.
2. Use Varnish Caching
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.
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.
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.
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:
- Default mode.
- Developer mode.
- Production mode.
- 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.
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.
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:
- Navigate to Stores > Settings > Configuration > Catalog > Catalog.
- 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.