It doesn't matter if you know a lot about Magento 1.x productivity – the second version differs much by another approach. For examples, Magento 2 is faster, less resource-hungry, and better optimized for high loads. Also, it offers many performance features (native support for Varnish, Redis, Nginx, and full-page caching) that in the first version were only available through customizations and extensions. However, there is still a lot of work to be done to perfect site's running speed.
FULL NGINX SUPPORT
There are three things Nginx was developed for: better performance, high concurrency, and low usage of memory. The mechanism of increasing the speed is that Nginx utilizes an event-driven asynchronous approach. Because of this, Nginx shows more predictable performance even under higher loads. Because of the native Nginx support, you can easily install it on the top of the platform.
This value cache provides top-notch performance and offers these features: pushing an element to a list, value incrementation in a hash, getting a sorted set of members with the highest ranking, appending to a string, and set intersection, union and difference computing.
The reason for high-performance results is due to incorporating several use cases for in-memory datasets. You can carry it on by dumping the dataset to the disk or append each command to a log. Also, if you need a multifunctional and in-memory cache, the steadfastness can be disabled.
Redis provides non-blocking synchronization and auto-reconnection with resynchronization partial on the net split. These features make Magento 2 a fast solution for every e-commerce site.
CACHE TYPES AVAILABLE FOR MAGENTO 2:
Configuration cache is gathering from modules and includes store-specific settings from the database and the file system.
Layout cache is gathering from compiled page layouts
Block HTML output cache includes HTML page fragments per block
Collections data cache includes database queries
DDL cache works with database schema
Entity attribute value cache is for Metadata related to EAV attributes
Page cache is for data about generated HTML pages
Translations cache includes merged translations from modules
Integration configuration cache is related to compiled integrations
Integration API configuration cache is compiling integration APIs
Web services configuration cache is the one of a web API structure
Find configurations and settings you've read before under System => Cache Management.
FULL PAGE CACHE
This type of caching stores the full page output. As a result, next page loads do not require much server load. This feature is necessary for high-traffic websites to keep server load as low as possible – it helps to avoid downtime even when the traffic is very high. Also, it helps increase the site's speed because the server needs will be reduced to fetching and rendering pages from the cache.
Magento can clean up a cache automatically, but you can still put data in any cache segment manually. After modifying any code that affects HTML output you should clean FPC. Keep the cache enabled to have the performance of your project always improved.
This HTTP accelerator serves to heavily consumed APIs and websites with a lot of content. Because it is an out-of-the-box solution for Magento 2, it is easily configured for any e-commerce project to increase its performance.
How does it perform? Varnish receives requests instead of a web server, looks at what is being sent, and then sends back a request to your web server that sends another response to Varnish to finally pass it to the client. Seems too long? The fact is that Varnish stores responses from the back end in its cache. That is why it rapidly serves further repeated responses using in-memory cache storage.
Because CSS has a powerful syntax, while working on non-trivial it grows to enormous sizes. Luckily, there are SASS and LESS – CSS preprocessors. For Magento 2, it is better to focus on LESS. It has such core features as nested syntax, ability to define variables and mixins, multiple files joining and a variety of operational and mathematical functions.
CSS AND JS MINIFICATION
CATALOG IMAGES CACHING
Magento generates cropped product images in different sizes to reduce its loading time on a page. The cache is generated during the first image upload and can be easily removed manually.
You can improve Magento 2 performance by adding unique features to the default setup. You are able to bring aspect-oriented programming, generic programming, and other complicated techniques to languages that aren't supported by default. But such performance may slow down the system, so you should utilize the command line to force the system to inspect the code and generate necessary classes.
REQUIREJS FOR IMPROVED JS PERFORMANCE
This tool is optimized for both JS environments and in-browser use. It is used to improve the quality of code and the speed of apps. The tool plays a key role if you want to improve JS development – it specifies dependencies between JS files and loads them into a browser. This can perfect website's performance in a great way.
SESSION STORAGE MANAGEMENT
Also, you can perform improvements in another way – by moving from files to the database or Redis. To do this, you should use the -session-save option with:
db – to move to the database. If it is a clustered database – choose database storage
redis – to move it the Redis backend
files – to store session data in the file system
OUT-OF-THE-BOX CDN SUPPORT
By providing CDN support there is an option to load media and static content from separate subdomains located on different servers of CDN networks. You can configure it under Stores => Configuration => Web.
Magento 2 will fully support PHP 7, a language with completely new performance and tons of new features and improvements. It is going to be much faster than the available PHP 5.x. The prediction is that PHP 7 will change our understanding of how fast an e-commerce site really should be.
GENERAL SERVER SIDE IMPROVEMENTS
What are the common performance optimizations?
Opcache – a code caching module that is specifically designed for improving the PHP part of the Magento performance. To store precompiled script bytecode it is used as a shared memory. Keep in mind that when optimizing Opcache settings, you are improving the performance of the Magento 2 website.
The proper configuration of MySQL and its alternatives is one of the most important enhancements to the performance of Magento 2. But there are some requirements for you: understanding of the hardware, knowing what settings to use. Also, there are two reliable substitutes: MariaDB and Percona.
New Relic – is a monitoring tool specially developed for identifying the problem of slow performance. which is a good reason to leave a web page in a few seconds.
You've just read thesis guide to Magento 2 performance. We are going to update it as soon as possible, so keep following us. If you have any thoughts about Magento 2, leave a comment or mail us to be heard.