1. Server Requirements
Server is a key factor affecting your site performance and loading speed.
- Use the dedicated server or VPS, should not choose shared hosting option. We suggest some best hosting providers: A2hosting, Siteground, or Nexcess. You can check the effective tips for choosing a good Magento 2 hosting here.
- Check the following System Requirements for Magento 2:
|Operating systems||Linux x86-64. Linux distributions such as RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, Debian, etc|
|Composer||Latest stable version. Composer is required for developers who want to contribute to the Magento 2 codebase or anyone who wishes to develop Magento extensions.|
|Web servers||Apache 2.2 or 2.4. In addition, the apache mod_rewrite module must be enabled. mod_rewrite allows the server to perform URL rewriting. For more information, see our Apache documentation. NGINX 1.8 (or latest mainline version).|
|Database||MySQL 5.6 (Oracle or Percona)|
5.5.x, where x is 22 or greater
7.0.2 (supported by Magento version 2.0.1 and later only)
|Required PHP extensions:||bc-math
gd, ImageMagick 6.3.7 (or later) or both
PHP 7 only: json
|PHP OPcache||PHP OPcache is strongly recommended to be enabled for performance reasons. The OPcache is enabled in many PHP distributions. To verify if it is installed, see our PHP documentation for CentOS or Ubuntu.If you must install it separately, see the PHP OPcache documentation.|
|PHP settings||Particular PHP configuration settings, such as memory_limit, that can avoid common problems when using Magento are recommended.|
|SSL||A valid security certificate is required for HTTPS.
Self-signed SSL certificates are not supported.
PayPal: You must use libcurl version 7.34 or later for Transport Layer Security (TLS) version 1.2 support required by PayPal.
|Mail server||Mail Transfer Agent (MTA) or an SMTP server|
|Magento can utilize the following technologies:||Redis version 3.0 for page caching
Varnish version 3.5 or latest stable 4.x version for page caching
memcached latest stable version for session storage with either memcache or memcached PHP extensions (latest stable version)
Magento Enterprise Edition (EE) only:
Apache Solr 4.x
Three master databases.
|Optional but recommended:||php_xdebug2.2.0 or later (development environments only; can have an adverse effect on performance);
PHPUnit (as a command-line tool) 4.1 or later
2. Images Optimization
Images are an important part of every eCommerce website, optimize your images is also optimize the loading speed. Several tips that you should follow when using images in your pages:
- Don't use HTML to scale the large photos - it takes the browser time to scale the images and they will look worse than the original.
- Always optimize your images. You can use Adobe Photoshop or Smush It to reduce the size of your images without lowering image quality.
- Don't insert too many images to a single article. Try splitting it into pages in case you have many photos.
3. Enable Flat Category and Product
You can shorten the reading speed of the database by enabling the Flat Categories and Product. It will help minify the number of database being joined when showing products, this action is extremely useful to the large store with hundreds of products. In additional, it will improve performance of the MySQL query
Go to backend, STORES >> Configuration >> CATALOG >> Catalog >> Use Flat Catalog Category and Use Flat Catalog Product >> select "Yes"
4. Merge CSS and JS Files
To enable JS & CSS optimization:
- Go to backend, STORES >> Configuration >> ADVANCED >> Developer >> CSS Settings
- Merge CSS Files >> Yes
- Minify CSS Files >> Yes
Don't forget to press Save Config after you are done!
5. Content Delivery Network
To set up CDN, please go to:
STORES >> GENERAL >> Configuration >> Web >> Base URLs (Secure) and then input your HTTPS CDN URLs here and enjoy the fast loading speed.
6. Utilize Caching
Varnish Cache is an open source web application accelerator that enables Varnish to reduce the response time and network bandwidth consumption on future, equivalent requests.
Magento 2 supports Varnish versions 3.0.5 or later or any Varnish 4.x version.
Go to STORES >> Configuration >> ADVANCED >> System >> Full Page Cache >> Caching Application change to Varnish Caching, than configure it.
You can find caching options of your Magento store here: SYSTEM >> Cache Management >> Select everything and then under the drop-down select "Enable" and click "Submit".
7. MySQL Configuration Optimization
There are a few tips to optimize via MySQL configuration. You can try and get the following settings in my.cnf
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.
Lastly, continue with a little setting for php.ini
8. Magento Updates
Magento team often updates Magento 2 versions with performance improvements, so ensure that you are running the latest version of Magento 2 version. It is one of the next important tips to speed up your store.
9. Check Your Magento 2 Website Speed
You can use some useful tools bellow to check your site speed:
- Kraken.io: Review images on your site and suggest you which you can optimize the loading speed of the site.
- Pingdom: It helps you to care about any related to server, network, or database
- PageSpeed: It indicates whether the page is performing well or not. It also suggests you the remaining issue need to be fixed.
- GT Metrix: GT Metrix offers you the most overview of what you need to do on the site and objectives you can expect.
Once you are finished optimizing, let's check your site speed. Hopefully, your site is much quicker now! Share with us if you have any other ways to optimize Magento 2 store performance.
If you like this post, don't forget to share it on the social network and subscribe our newsletters to get updates.
Thanks for reading this!