Jim wanted to buy some groceries online and he was surfing for the best deal. He signed up to a local website and started looking for products he wanted to order. As the website was slow to load, he searched for another grocery shopping website and could place an order within a few minutes.
If you own an eCommerce store, it is important to check the speed of the site. It matters a lot as no one would like to make a purchase from a website that is slow to load. You could be losing a lot of business with a sluggish website as nobody wants to waste time in today’s busy world. Think about it!
A fast loading website can have a positive impact on your search rankings too.
Magento 2 is a popular eCommerce platform that is used by many web owners to create user-friendly web stores. Website owners should optimize their Magento 2 store to ensure success.
These five proven tips can enable you how to speed up Magento 2 website.
Let’s dive in!
1. Check all The Third Party Extensions
Before you start working on optimizing Magento 2 website speed, you should check all the third-party extensions that have been installed on your website.
Several Magento 2 extensions are available for free, while some others are paid. Some Magento 2 extensions may not be developed for optimization and when installed, they may slow down your website.
It is important to check the speed of Magento 2 website whenever you install any third-party extension. It can be a good idea to turn off the extension and check the speed.
If you feel that the website is faster after turning it off, then you can get in touch with the extension provider and discuss the same. You can ask the providers to replace it or fix the issue.
2. Server Requirement and Configuration
The server is a key factor that determines the performance of a website. If the server does not function properly, you cannot have a fast loading website.
Investing in a good hosting provider becomes crucial when you have an eCommerce website so avoid choosing free or shared hosting. If you do not have a problem with the budget, you can opt for a dedicated server or VPN.
Magento 2.2.x technology stack requirements:
- Operating system (Linux x86-64)
- Memory requirement: Up to 2GB of RAM
- Composer (latest stable version)
- Web servers: Apache 2.2 or 2.4, nginx 1.x
- Database: MySQL 5.6, 5.7
- PHP: 7.0.13–7.0.x, 7.1.x
3. Content Delivery Network
CDN is a system of distributed network services that provide web content to the users according to the geographic locations. It also helps visitors load web pages faster.
To set up CDN, please go to:
Stores -> Configuration -> General -> Web -> Base URLs (Secure)
After that, you can insert your HTTPS URLs to speed up your website.
4. Optimize The Images
eCommerce websites have a lot of images and banners for attracting the attention of the target users and display the products. Images can affect the website’s performance. It is important to use compressed images for less data usage and faster page loading.
For product images, you should use JPEG format. Logos on the website can be used in PNG or SVG format.
5. Enable Flat Catalog
One of the major problems with Magento is the read speed of the database. If your Magento 2 website has a lot of products, then you may face the problem of a slow loading website.
You can enable flat categories and products to increase the read speed of your database. It helps to reduce MySQL query complexity and improves the performance of your website.
How to enable flat options?
Go to Stores -> “Configuration” in “Settings” Section -> “Catalog” in “General” Tab -> Section “Storefront” -> Fields “Use Flat Catalog Category” and “Use Flat Catalog Product” change to “Yes”
6. MySQL Configuration Optimization
These are some little tips to optimize via MySQL configuration.
MySQL has its own “query cache” that it uses in Magento to help generate dynamic pages and content while improving performance. These are some recommended settings for your my.cnf file.
You can try this:
- query_cache_type = 1
- query_cache_size = 32M
- query_cache_limit= 2M
At last, This is a suggested setting for php.ini.
- php_value memory_limit 128M
7. Utilize Caching
Magento comes with a built-in caching module. Make sure all Cache Types are enabled by navigating to “System” → “Cache Management”.
8. Change To The Production Mode
You should run Magento in production mode once it is deployed to a production server. Production mode provides the highest performance in Magento 2.
- php bin/magento deploy:mode:set production
The most important aspect of this mode is that errors are logged to the file system and are never displayed to the user.
In this mode, static view files are not created on the fly when they are requested; instead, they have to be deployed to the pub/static directory using the command-line tool. The generated pages will contain direct links to the deployed page resources.
9. Enable JS & CSS optimization
CSS and JS files help your frontend look better. However, they are one of the core factors that slow down your site speed. Luckily you can minimize the influence in Magento 2 by enabling JS & CSS optimization
To enable JS & CSS optimization:
And on the same page, click on “CSS Settings” (Fields “Merge CSS Files“, “Minify CSS Files“ change to “Yes”)
10. Clean the Log Files
While optimizing the Magento database, you can also check your Magento project’s var/log directory. Sometimes it has around 200MB size so it is time for cleaning.
Please take a backup first of that directory in case of rollback.
After it, please go to your Magento project’s var/log directory and run below command,
rm -rf *
NOTE: Make sure that when you run the below command, you must double-check that you are in your Magento project’s var/log directory.
11. Magento Updates
Magento team constantly works on improvements in performance. You should not miss out any updates and ensure that your eCommerce store is upgraded as per the latest version of Magento 2. You can look for an expert Magento web development company to help you update your website.
There can be several reasons why your Magento website is slow. It is important to identify the reasons and check all the factors to ensure the high speed of your eCommerce website. If you do not know how to check the above-mentioned points for your website, you can look for expert Magento developers to help you. Hire the best Magento 2 web development company to make your website fast loading.