- 30 July 2021
- Magento 2
- Reading time:10 min
How To Improve Your Site Speed: The Ultimate Guide to Magento 2 Speed Optimisation
Whilst Magneto is one of the most popular enterprise-class eCommerce platforms used by one in four businesses, it still needs to be optimised for speed.
Whilst Magneto is one of the most popular enterprise-class eCommerce platforms used by one in four businesses, it still needs to be optimised for speed. Magneto 2 speed optimisation isn’t for the faint-hearted, but if you have the time, enthusiasm and the skills, you can do some of it yourself. On the other hand, it’s probably much easier to give this type of specialised job to a Magneto developer who has the experience to do a good job.
Why is Magneto 2 speed optimisation so important?
As a website owner, you already know that speed is everything on the internet. Shoppers are impatient and don’t like slow opening web pages, causing them to quickly close their browser and move onto the next site on their list. This increases your bounce rates and decreases your sales, conversion rates and revenue. Slow speeds also loses you repeat customers, because they won’t bother returning if your site is too slow.
The best Magneto developers know that even Google also doesn’t like slow-moving websites. In fact, it likes fast-moving websites so much that it is preferentially crawling mobile sites, rather than desktop versions. Since this ‘mobile-first’ indexing focuses on how well your website renders on mobile devices, the lack of a fast mobile experience could negatively affect your rankings. So if your Eommerce store is taking too long to load, Google may well rank you lower than your competition – it’s that important!
So let’s take a look at how to increase a Magneto website’s speed, helping you to decrease your bounce rate and increase your rankings, traffic and sales.
Tips on how to increase a Magneto website’s speed
1. Check your website’s speed
There’s no point in optimising your site’s speed if you don’t have a starting point. So it’s essential that you check the loading times, giving you a baseline for later comparisons. There are a number of ways you can do this, one of the most popular is to go to gtmetix.com, insert your website’s URL and it will give you your site’s loading speed. It also gives you a report that most people can’t understand however, but at least it gives you your site’s speed. Another option is to check your site’s TTFB (time to first byte), which is a measure of how long it takes for the first byte of your website to travel from the server to your browser; it should be less than 200ms. You will need to enter your URL into the Sucuri Loadtime Tester or use the Chrome Developer Console. One solution for increasing your site’s TTFB is to change to a faster server, but this can be a pricey option.
2. Is your site running in production mode?
When you first load Magneto it runs in default mode, which lets you make simple changes to your store before it goes live. You might also want to use the developer mode to perform more in depth changes. The problem is that both of these modes slow your site’s loading times, so you need to move it into production mode.
You can change these modes using the Command Line Interface, as follows:
php bin/magento deploy:mode:
If the result is that you are not in production mode, type in these commands:
php bin/magento deploy:mode:set
production
It might not sound like much, but it will help to significantly increase your site’s loading times.
3. Use caching tools to speed up loading times
Another Magneto 2 speed optimisation strategy is to use caching tools. The cache is where frequently used data is stored, so that it can retrieved quickly without having to search for the information each time a request is made to the server. Redis and Varnish are third party software caching tools that help to improve the performance of Magneto 2. Redis does this by retaining data in the RAM, whilst Varnish does the same, only better. Essentially, any data stored in RAM can be accessed and read quickly with minimal effort, which is why both Redis and Varnish increase your website’s performance.
The difference between these two caching tools is that when you use Varnish a request from a shopper’s browser doesn’t go to the server, instead it gets intercepted by Varnish which downloads the pages directly to the browser. This reduces the load on the web server and speeds up the whole process. Redis on the other hand, just speeds up the delivery of these web pages from the server. Whilst both of these caching tools significantly increase the performance of your website, Redis requires a lot of RAM, so it puts a drain on the server, which doesn’t happen with Varnish.
Varnish however, doesn’t work with HTTPS and SSL certificates, so you need to set up a proxy to decrypt the HTTPS traffic before it reaches Varnish. It’s possible for you to download and configure either one of these caching tools, but it’s very complicated. It takes even the best Magneto developers time to optimise these caching tools properly, so you might need help with this step.
4. Remove unused extensions
The more extensions you use with Magneto 2, the lower your site’s performance. It might not be much of a hit, but it all adds up. Log into your Magneto server using SSH (a secure shell protocol that lets you connect to a server without sending your username or password over the network) and check out the modules folder for any extensions that aren’t being used. If you do this, be careful that you don’t delete common extensions that serve as the base for other extensions or you will lose everything. If you are in production mode, you can submit the following commands to disable and delete the extensions you don’t want to use anymore.
bin/magento maintenance:enable
bin/magento module:disable TestExtension
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy en_US de_DE
bin/magento maintenance:disable
cd app/code/TestExtension/
rm -rf TestExtension
5. Flatten your category and product catalogues
In Magento 2, product attributes are stored across multiple database tables, so when a shopper wants to view a product, this information must be drawn from these tables. The more tables that need to be accessed for this information, the longer it takes and the poorer your site’s performance. The easy solution is to consolidate all this information, so that the process is speeded up. This is called flattening your catalogue and the more products on your site, the faster it will perform. To make this happen, all you need to do is to go to your catalogue (stores > configuration > catalogue) and click ‘yes’ in the box next to ‘Use Flat Catalogue Category’.
6. Speed up search results
One of the easiest Magneto 2 speed optimisation strategies is to speed up your site’s search results. That’s because if you have an extensive product list, it can take too long for a shopper’s search results to display on your web page in their browser. This leads to a poor user experience and long loading times. The solution is to speed up this search process by using the Magneto 2 Elasticsearch extension. It’s a server based tool that is capable of full text searches at very high speeds. It’s also very scalable so it’s perfect for sites with growing product lists. It works well out of the box and supports multiple languages, as well as stop words and synonyms, and SKU codes. For super-fast indexing and search functionality, Elasticsearch is one of the best on the market. You can upload and configure this extension using the following commands:
elasticsearch:
type: elasticsearch:<version>
disk: 1024
relationships:
elasticsearch: “elasticsearch:elasticsearch”
$ git add -A && git commit -m “Enable Elasticsearch” && git push origin <branch-name>
$ bin/magento indexer:reindex catalogsearch_fulltext
$ bin/magento cache:clean
7. Update your old Magento theme
This might not be at the top of your list, but an old and outdated Magento theme can seriously slow down the performance of your site. Some of these older themes can use a lot of bandwidth, costing you more money for hosting compared with updated themes. If the developers of your old theme have stopped issuing updates, it’s time to refresh your website. A new lighter and more modern theme has the positive side effect of faster performance, so it’s a win-win situation. If you really want to stick with your older theme however, you can optimise the images to increase your site’s loading speeds. There are lots of free image optimisation tools available online, and this strategy will help speed up your site to some degree. There are other problems with old themes however, such as security issues, so why not hunt around for the best magneto developers in your area and have a conversation about updating your theme?
Now you have some idea of how to increase a Magneto website’s speed, what are you waiting for?
To chat to the best Magneto developers in Sydney about making your Magneto website lightning fast, call acidgreen on 1300 139 658 or send us an email enquiry today.
Related articles
- Magento 2Top 5 Best Magento 2 Extensions For Your Ecommerce StoreMagento 2Are you in the market for the best Magento 2 extensions? Magento is a powerful opensource eCommerce platform with world-class features and a mobile-friendly interface.
- Magento 2MAGENTO 2 MIGRATIONMagento 2 Magento Ecommerceacidgreen was one of the first official Magento Partners in Australia. With over 15 years of eCommerce experience, we have delivered over 200 online stores, including M2 Upgrade installations.
- Magento 2How Progressive Web Apps and Magento Commerce Are Changing Mobile CommerceMagento 2 Magento EcommerceAs always Magento Commerce is paving the way, and with the help of progressive web apps, they are delivering a next-level mobile customer experience.