0%
Magento 2 is known for its robust features but can sometimes suffer from slow performance if not properly optimized. Faster Magento speed, however, can lead to higher engagement, better conversion rates, and improved rankings on Google.
This article provides 10 easy steps to improve Magento performance with no radical customizations. Read on to learn how you can ensure a smoother experience for your visitors and better performance on Google PageSpeed Insights without any serious investments.
Step 1: Analyze Performance with Google PageSpeed Insights
Before diving into optimization, you need to understand where exactly your site stands. Google PageSpeed Insights is a tool that can analyze your website’s performance and provide actionable recommendations. Here’s how to do it:
- Visit Google PageSpeed Insights.
- Input your Magento store’s URL
- Click “Analyze.”
After a few moments, you will see scores for both mobile and desktop versions of your site, along with detailed suggestions for improvement. Understanding these insights will help you prioritize the areas that need attention. Our next 9 steps will help you resolve most, if not all the possible issues, commonly pointed out by PageSpeed Insights.
Step 2: Enable Full Page Caching
Using full-page caching, Magento stores can serve cached pages to users, significantly reducing load times. This is particularly beneficial for returning visitors who can load pages almost instantly. You can activate FPC by following these steps:
- Log in to your Magento 2 admin panel.
- Go to Stores > Configuration > Advanced > System > Full Page Cache.
- Choose between a Built-in Application or Varnish Caching. While the built-in application is a good start, Varnish Caching offers superior performance. We’ll explain why in the next step.
- Click on “Save Config” to apply the changes.
Full page cache is a powerful feature that can boost the speed of your Magento 2 store by reducing the time it takes to load pages for returning visitors. However, make sure to regularly clear the cache to ensure that users are seeing the most up-to-date content.
Step 3: Utilize Varnish Cache
Varnish Cache is a web application accelerator that can drastically speed up your Magento 2 store by caching the HTTP responses and serving them quickly to subsequent requests, reducing the load on your web server.
To leverage Varnish, ensure that you have it installed on your server (ask a Magento expert or your system administrator for help) and configure Magento to use Varnish according to the instructions in the previous step.
Step 4: Optimize Images
Images are often the largest assets on a webpage and can greatly impact the time any page loads. That’s why you need to optimize them, aiming for an ideal balance between the quality and file size.
- Choose the right format – Use JPEG for photographs, PNG for images requiring transparency, and SVG for icons and logos.
- Compress images – Use tools like TinyPNG to compress images without losing quality.
- Use an image optimizer app – Install an image optimization extension for Magento 2, such as TinyPNG or PageSpeed Optimizer to automate the compression process.
Another way of optimizing images is opting for lazy loading, but let’s talk about it in a separate step.
Step 5: Enable Lazy Loading
Lazy loading is a JavaScript technique that helps to postpone the load of images and other media until they are in the viewer’s focus. This reduces the initial page load time and conserves bandwidth.
You can achieve lazy loading by adding the loading="lazy" attribute to your image tags. Still, a more convenient way that will affect all images on your website is using a Magento extension:
- Install a Magento 2 extension that supports lazy loading, such as Amasty’s Page Speed Optimizer.
- Navigate to the extension settings through the admin panel.
- Enable lazy loading and configure settings as required (e.g., loading effect, threshold).
After finishing the configuration, check your website and see if the images and media load as you scroll down the page.
Step 6: Enable Flat Catalogs
Flat catalogs improve the speed of database read operations. They use a single table to store product and category data, reducing the complexity of database queries.
Opting for flat catalogs is pretty easy:
- Log in to your Magento 2 admin panel.
- Go to Stores > Configuration > Catalog > Catalog > Storefront.
- Set Use Flat Catalog Category to Yes.
- Set Use Flat Catalog Product to Yes.
- Click on “Save Config” to apply the changes.
- Run the reindexing commands via SSH: php bin/magento indexer:reindex
After enabling flat catalogs, you’ll notice faster page loads, especially if your website has a large catalog with numerous products and categories.
Step 7: Implement a Content Delivery Network (CDN)
A Content Delivery Network (CDN) distributes your content across multiple servers worldwide, allowing users to download resources from a server that’s geographically closer to them. Naturally, this reduces server response time and speeds up page load times.
First, you need to select a reliable CDN provider such as Cloudflare or Amazon CloudFront. Then, follow these instructions:
- Log in to your Magento admin panel.
- Navigate to Stores > Configuration > General > Web.
- Under Base URLs and Base URLs (Secure), enter the CDN URLs for your static files and media files.
After configuration, don’t forget to purge the CDN cache to serve the latest version of your files.
Step 8: Minify and Merge JavaScript and CSS Files
When you minify and merge JavaScript and CSS, you reduce the number of requests and the size of these files during page load. Needless to say, this also leads to faster load times. You can manipulate the JS and CSS files through the admin panel as well:
- Go to Stores > Configuration > Advanced > Developer.
- Under the JavaScript Settings, set Minify JavaScript Files to Yes.
- Under the CSS Settings, set Minify CSS Files to Yes.
- Under the JavaScript Settings, set Merge JavaScript Files to Yes.
- Under the CSS Settings, set Merge CSS Files to Yes.
- Click on “Save Config” to apply the changes.
Finally, run the following command via SSH to deploy the static content:
php bin/magento setup:static-content:deploy
Step 9: Switch to Production Mode
Magento’s Production Mode can disable the developer-specific features and optimize the deployment process. Running your Magento 2 store in Production Mode will optimize performance by decreasing server load and speeding up page rendering.
First, you need to check the current mode of your Magento store by running the following command in SSH: php bin/magento deploy:mode:show. If it’s not already in Production Mode, switch to it by running: php bin/magento deploy:mode:set production. Once you’re done, make sure to reindex the data and clear the cache to apply the changes.
Step 10: Optimize Server Settings
Optimizing server settings will ensure that your server can handle requests efficiently, improving overall site performance. Here are a few tips:
- Enable HTTP/2 – HTTP/2 can handle multiple requests over a single connection, reducing latency. Check with your hosting provider to enable HTTP/2.
- Increase PHP Memory Limit – Ensure that your server has sufficient memory allocated to PHP processes. This can be done by editing the php.ini file: memory_limit = XM
- Use OPcache – OPcache stores precompiled script bytecode in memory, reducing the load time of PHP scripts. Enable OPcache in the php.ini file:
opcache.enable = 1
opcache.memory_consumption = 128
- Optimize MySQL Configuration – Tune your MySQL configuration to handle Magento’s database operations efficiently. Increase the innodb_buffer_pool_size to about 70-80% of your server’s total RAM.
- Use a Fast Server – Consider using a dedicated server or a high-performance hosting solution optimized for Magento.
These techniques can help you ensure that your Magento store runs smoothly and will handle high traffic volumes without compromising speed.
Final Tips
Optimizing the speed of your Magento 2 store is key to providing a seamless user experience and improving your search engine rankings. In addition to the already listed techniques, do not forget to:
- Always use the latest version of Magento to benefit from performance improvements and security updates.
- Rely on tools like Google PageSpeed Insights and GTmetrix to regularly check your site’s performance and identify new optimization opportunities.
- Consider requesting professional speed optimization services if none of the tips above have brought a significant speed increase.
Stay proactive and continuously optimize your website, keeping it fast, reliable, and capable of providing an excellent user experience.
With 7 years of experience in the IT industry, Yaroslav T. specializes in e-commerce solutions. He has developed approximately 15 online stores, ranging from medium-sized shops to large marketplaces, gaining extensive experience across various industries including financial services, retail & distribution, and life sciences & healthcare. Skilled in Adobe Commerce, he excels in frontend development solutions for this CMS.
Experienced SEO Specialist with a proven track record of improving website visibility and search engine rankings. Skilled in keyword research, on-page and off-page optimization, link building, and content strategy development. Passionate about staying updated with the latest SEO trends and algorithm changes to ensure optimal online presence.