Customers hate slow websites. If your website loads longer than 3-5 seconds, with each extra second you lose 12% of website views, about 16% in your conversion rate, and overall customer satisfaction drops by 16%. If you don’t want to lose potential customers due to poor website performance, you should probably start Magento 2 performance tuning right now.
The good news is that Magento is an open-source platform. You have full access to its back-end and can make any changes for Magento performance tuning. Some of these issues can be easily eliminated without extra expenses added to the Magento developer’s services. Others require decent programming experience.
Let’s see what the most valuable Magento performance optimization tips are, and then decide which of them can or should be applied to your online store.
What Performance Metrics Should Be Measured For Magento Speed Optimization?
Although Google proposes its own recommendations for a website’s load time (2 seconds or less), every customer has their own preferences and ideas on how fast a site should load. The main rule to stick to is this: the faster the load speed, the better. However, to have a true idea about your website performance, it is not enough to just measure the full load time and stop there. There are several other important time indicators to track:
- Time to First Byte (TTFB) – the time needed for the first byte to reach a user’s browser after a connection to the server has been established.
- First paint – an important, but not typically regarded, point at which the user gets an indication that a page is loading (display of the background color, etc.). Before this moment, the user can only see a blank page. However, this timing does not show how fast the page load speed is.
- First Contentful Paint – the timing that shows the moment when the first content on the page is painted. This can be an image, text or any other consumable information.
- DOM interactive – the point when all HTML has been loaded and parsed by the browser, and the Document Object Model (DOM) is already built. (DOM is the way a browser structures HTML)
- Onload – the moment when all the resources, files and other content on the page have been downloaded in full.
Magento 2 Performance Optimization Tips
With Magento 2, you can build a fully functional online store of any size. However, after enhancing the default functionality of the CMS with a bunch of custom features, most e-commerce business owners face frequent downtimes and issues with the performance of a store. Let’s take a closer look at these issues and see how they can be solved.
#1 Choose a hosting wisely
The choice of hosting is a critical issue for Magento 2 websites. Magento optimization should always start with a thorough revision of a current hosting provider and a hosting plan you are subscribed to. Shared hosting for $5/month is generally not a good choice for Magento. The greater your online store is, the more powerful and fast your hosting needs to be. In some cases, it is enough to upgrade a hosting plan, but some online stores will never show good performance until they are hosted on a dedicated server.
#2 Use a CDN
If you enable a Content Delivery Network (CDN) for your online store, all the resources of the site will be copied to a network of connected servers, the location of which will depend on the location of your potential customers. When users open your website on their devices, the CDN determines which of the servers is the closest, and all the files (images, JS and CSS files, videos, and other resources) are transmitted to the user’s browser in the shortest way. As a result, server response time shortens and website load speed increases.
Today, most reliable hosting providers offer a CDN connection along with their services. But if it is not available with your current hosting, you may look for CDN provider services in addition to your hosting plan.
#3 Enable Caching
Caching is one of the best ways to optimize performance. One of the most useful tools for Magento performance optimization is a Full Page Cache (FPC). Once you turn FPC on in a website admin panel, it allows for the server to retrieve and display the page in just a few milliseconds, without overloading. Thus, the website will process pages for visitors much faster.
This feature allows the website’s backend to remember the page content and not require it to be collected again from scratch when it comes to repeated requests. Instead, users will receive the already assembled page.
Magento has at least 14 types of cache. Learn how to set up and enable each type from this guide.
#4 Revise third-party extensions
Although most custom extensions are made to add functionality to your store, each of them has an impact on website performance. With such a variety of third-party extensions available on the Magento Marketplace (over 3000), it is hard to resist the temptation to install another module. Often, on the initial audit of many of our clients’ online stores, we find dozens of installed Magento extensions, most of which are either not in use or affect the performance so much that the benefits are wasted.
In this regard, we strongly recommend that you revise all third-party extensions that have ever been implemented in your store. Extensions that are not used must be completely removed from the e-commerce store. For those that perform important tasks, but significantly slow down a website, there are several possible options:
- 1. Address the extension support team. Tell them about your problem and ask if it can be solved on the provider side.
- 2. Replace the current extension with another one that will not harm your website performance.
- 3. Optimize the extension by yourself or with the help of an experienced Magento 2 developer.
If none of the above options serve your needs, the only next possible solution is to develop the needed custom functionality from scratch.
#5 Tune the server-side
The bigger part of loading processes are performed on the backend of the website. The speed of your website load time depends directly on the load amount and processing time. To set up and optimize processes on the backend, we recommend that you apply the following steps:
Reduce the number of HTTP requests
Reducing the number of requests is one of the most helpful methods used for Magento 2 performance optimization. Particularly, the majority of performance optimization steps are aimed at reducing the number of these requests. So, by applying the Magento optimization tips mentioned in this article you will cut the number of requests and your website performance will skyrocket.
Although 301 redirects are useful in some cases, they are also killers of the Time to First Byte and, consequently, of website performance. The TTFB is fixed once a browser gets the first “200 OK” response from the server. When it comes to Google, officially TTFB is considered the main performance indicator of a website, and the better your website performs, the more chances you have to reach the top of the search results.
Nowadays, it’s generally accepted that server response time should be less than 200 ms. That’s why, if your website shows a lacking response time, your first move should be to minimize redirects or, even better, eliminate them.
Merging and minification can be done in several ways. Such tools in Magento 2 are available both out-of-the-box and with third-party extensions.
Enable GZIP compression
Fix 404 errors
Missing pages and missing files throughout your website result in 404 errors. Such errors may cost you on average from 60 to 100 Mb of memory just to return that 404 error code.
To avoid 404-page issues, use redirects or design such pages in a way that users who land on a non-existent page do not feel lost and can easily find a way to the page they were looking for.
#6 Optimize images
Every online store has hundreds of images, product photos, thumbnail images, banners, and other visuals. They are all used to attract the targeted users. But with every new image uploaded, you lose in website performance. To speed up a Magento 2 store you can adopt one of the following techniques:
Control the size of images
Don’t make them too large or too small. Any image in your Magento 2 store should not exceed 1920px high and 1200px wide. Additionally, if you add images with poor resolution, they will appear blurred, which will not impress your customers.
Compress images wisely
To compress images without losing their quality, you can use one of the options below:
- Magento 2 extensions, like Apptrian or Potatocommerce, will optimize images once they are uploaded to the website.
- Command-line tools, like Gifsicle, Jpegtran, or OptiPNG, help to perfectly compress images without quality degradation.
- Run the page test through the Google PageSpeed Insights tool, and get a detailed estimation of the image size you can save after their optimization.
Use WebP images
Changing the format of your images to WebP will make images 30% lighter than JPEG, and on average, 26% lighter than PNG. To convert your current images into WebP you can either use online services like Online Convert, WebP Converter, Egzif or Adobe Photoshop with a pre-installed plugin like Telegraphics and AdoveWebM.
Every website includes a lot of small images, such as logos, stars, arrows, and other elements of the interface. When a user opens the website, the browser makes dozens of requests to the server to display all those images. A sprite is an image which contains all the small interface images in one. With a sprite, the browser will send only one request to get all interface images at once. Try one of these tools: CSS Sprites, and Instant Sprite.
When uploading images to your store, let customers find your store in Google by those pictures, and help search robots to index them easier. To make this happen, do the following:
- Write alt tags and titles for images
- Properly name images
- Create sitemaps to help crawlers find non-indexed images faster
We develop optimized
#7 Keep your Magento 2 store updated
The Magento team is constantly working on improvements for the platform. With each new update, Magento 2 shows better performance and provides developers and e-commerce business owners with wider opportunities for tuning functionality and improving site performance.
By not updating your Magento 2 store, you miss not only the newest features, but also security patches. This makes your resource an easy target for hackers.
Performance matters! Magento 2 speed optimization is an important and complex task that requires more than just a desire. Of course, some of the listed tips (for example, image optimization or change of the hosting provider) can be performed by a non-tech-savvy merchant. The rest of them require at least some technical knowledge.
To find the major bottlenecks in your website performance, you should first test your store with one of the performance analyzing tools like GTMetrix or Google PageSpeed Insights. This will give you superficial data about the current website performance and indicate the points to be optimized.
We hope you are now ready to confidently start down the Magento performance optimization path. Still, if you’ve got any questions, need any clarification, or are looking for professional assistance, feel free to contact us anytime. We will survey your online store and come up with a complimentary assessment outlining your performance optimization solutions.