Magento 2 Performance Optimization: Complete Checklist
Posted on 19 June 2017
It's no secret that the speed of the Magento 1 platform is its main drawback. The platform requires a serious optimization and hardware environment. Optimizing Magento 1 store is an indispensable stage for any online business that wants to excel in fierce competition.
But how is the situation with Magento 2?
Magento 2 platform, if it is configured according to all the recommendations, shows impressive results. Many modern technologies have been implemented in Magento 2 both on the server side and to accelerate the rendering of pages: Varnish, Redis, Full Page Cache, Nginx, LESS and others.
First of all, this is achieved thanks to the Full Page Cache, which in Magento 2 goes out of the box.
Overview of Magento 2 performance optimization
Improved indexing system
Indexing is the process of data conversion, which is designed to improve the performance of the site. The indexing architecture has been significantly improved in Magento 2, which allows the platform to run faster.
Full Page Cache
Full Page Cache (FPC) significantly reduces the response time (Time to First Byte), which thereby significantly speeds up the loading of the page. FPC caches pages of products, catalogues and CMS pages (including homepage and 404 page). FPC is faster than the standard Magento cache 2-3 times, which allows to reach 50-200ms server response time. The real time to first byte depends on the distance between the server and the client, on how robust server hardware, and on current load of the web server. You can check whether FPC is enabled in System> Tools> Cache Management. The FPC settings are located in Stores> Configuration> Advanced> System> Full Page Cache
Varnish is a free server software that is designed to speed up web pages that are on Unix servers. Varnish is used for many platforms, including Drupal, Wordpress, Magento, etc. Varnish works as front-end for any web servers. Varnish has multithreading feature and is very efficient. To enable and configure Varnish in Magento 2, go to Stores> Configuration> Advanced> System> Full Page Cache and select “Varnish Cache” in the Caching Application option.
Redis technology allows Magento to work with the cache more efficiently. Thus, all cache including Full Page Cache) will work even faster with Redis.
Content Delivery Network (CDN)
CDN is used to create copies of files on servers that are geographically closer to the client. Thus, files (media, js, css, and others) are downloaded faster than browsers, which makes the page load faster.
If you are using Amazon S3 or Amazon Cloudflare, then we recommend that you to use the CDN Synchronizer, which automatically synchronizes data between the Magento and CDN.
Optimizing files will help make the overall page size significantly smaller, which reduces the time required to load the page. To automatically optimize the files of JPG, PNG and GIF types, you need to use Image Optimizer Magento 2 extension.
JS and CSS minification
Despite the fact that in magento 2 has is a function to minify js and css files, we do not recommend using it, because it does not work properly. Files are minified after download, not before, which only degrades performance.
Instead, you can use Performance Optimization Tool - the only Magento 2 extension on the market which really optimizes JS and CSS content.
Magento Performance Toolkit
Magento 2 was enhanced with a toolkit for testing Magento performance on a generated data using Apache jMeter. You can find Magento Performance Toolkit user guide here. This toolkit helps to find the bottleneck in code; therefore to prepare the website for production.
Flat Categories and Products
To speed up product collection you can enable Flat Catalog Category and Flat Catalog Product. When enabled, tables of data with product information and categories are created "on the fly". Depending on your cron settings, which specify the frequency of tasks, the flat catalog will be updated automatically.
Enable GZIP Compression
GZIP compression allows you to reduce the size of downloaded files. GZIP compression works on the same principle as file archivers. To enable gzip compression on apache, you need to modify the .htaccess file.
Keep Magento up-to-date
The timely updating of the Magento platform allows not only to have the most secure and powerful system, but also the fastest version of the platform.