10 Easy Ways To Speed Up Magento 2
Fast speed has become one of the crucial factors that boost rank and convert better.
There are many performance optimization techniques out here. In this post, I am going to share with you 10 simple tips to speed up magento 2 store.
1. Server Requirement & configuration optimization
As you may know, server is the key factor for site performance. If your picked server is not good enough you can’t have a good website. Hence, in order to have a good website, we highly suggest you to replace it with a dedicated server. Moreover, when you choose host, please keep these categories in mind.
a. Choose dedicated server or VPN
b. Do NOT take shared hosting option.
c. Carefully check magento system requirements
- Operating System: Linux x86-64
- Composer: Composer will help manage modules easily. It is highly suggest to use the latest version.
- Web Server: Apache 2.2 or 2.4. Moreover, The apache mod_rewrite module must be enabled. Learn more, see: Apache.
- Nginx 1.8.x
- PHP: PHP 5.6
- PHP 5.5
- 7.0.2 (supported by Magento version 2.0.1 and later only)
- Database: MySQL 5.6.x (Oracle or Percona)
- SSL: A valid security certificate is required for HTTPS.
- Self-signed certificates are not supported.
- Mail server Mail Transfer Agent (MTA) or an SMTP server
- Reverse Proxy / Web Accelerator: Varnish 3.5
- Varnish 4.x (or latest stable version.)
- Cache Storage: Redis 3.x
- Memcache 1.4.x
2. MySQL configuration optimization
Let’s me show you a little tips to optimize via MySQL configuration. You can try and get the following sttings in my.cnf
query_cache_type = 1
query_cache_size = 32M
In case you can get access to root to check /etc/my.cnf (or /etc/mysql/my.cnf), please login to mysql or use phpmyadmin to show variables.
$ mysql -u mysqluser -p magento_database_name
$ mysql> SHOW VARIABLES;
Lastly, continue with a little setting for php.ini
3. Enable JS & CSS optimization.
Css and JS file help your frontend look better. However, they are one of the core factors that slow down your site speed. Luckily you can minimize influence in magento 2 by enabling JS & CSS optimization
To enable JS & CSS optimization:
Go to Stores -> “Configuration” in “Settings” Section -> “Developer” in “Advanced” Tab ->-> Section “CSS Settings” (Fields “Merge CSS Files“, “Minify CSS Files” change to “Yes“)
4. Content Delivery Network
CDN is a system of distributed servers that deliver Web content to a user based on the geographic locations; simultanously, it helps your visitors load page faster as a result.
To set up CDN, please go to
STORES -> Configuration -> GENERAL -> Web -> Base URLs (Secure)
then insert your HTTPS URLs in here and bring your customers fast loading speed.
5. Have caching enabled.
To enable Full Page Cache
Go to Stores -> “Configuration” in “Settings” Section -> “System” in “Advanced” Tab -> Section “Full Page Cache” -> Field “Caching Application” change to “Varnish Caching“, than configure it.
6. Enable Flat Categories and Products
One of the main problems that slow down magento 2 speed is the read speed of database; especially, in case your magento 2 store has a large number of products.
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”
7. Images Optimization
There are 2 things that need to be kept in mind:
A. You image must be compressed.
B. Product Image should use JPEG format
C. Logo and layout should use PNG or SVG format
8. Change to production mode:
php bin/magento deploy:mode:set production:
9. Optimize magento database by Cleaning log
If you are wondering when you need to optimize magento database, you can check your site. In case you have around 200MB, it is time for cleaning.
As you can see, database is needed for better tracking in case something wrong happen with your customers and their order. Hence, before you do anything related to database, please backup data first. Here is step by step to clean database log
>> Optimize magento database Log Cleaning
There are three options for you to clean out: via Log Cleaning in the Magento Admin, via log.php in the ../shell directory, and manually via phpMyAdmin or mysql client.
10. Magento Updates
Magento updates frequently comes with significant improvement in performance, hence, do not miss this chance to get your site faster
After following all steps successfully, please check your site performance.