Magento 2 has introduced multiple performances enhancing updates. Most important of them being improvements to Caching, Page Speeds and Code Base improvements.
Every time a page is fetched from the cache instead of requiring a PHP server to generate it, it results in improved scalability and reduced latency.
When a page is fetched from the cache, it reduces the CPU usage and the freed up CPU usage can be made available to other requests enabling improved scalability. This does not undermine the PHP server speed as it is still important for generating dynamic pages like checkout etc. that cannot be cached always because it has data relevant to each specific user. More than one-third of the page load time is used up by the PHP server in generating the page. Retrieving the page from the cache reduces this server time, thus improving page load speeds and reducing the latency.
Magento 2 has made a lot of improvements in how caching is done. Some of them are listed below:
- The latest version has been built in Full Page Caching that speeds up the site considerably. It does this by reducing the network round trips and disk read frequency.
- It has out-of-the-box support for Varnish 4 and Redis.
- It has also introduced static content caching in the browser.
- It is now compatible with HHVM 3.6 or Hip Hop Virtual Machine. HHVM is being used by the likes of Facebook to achieve on the fly PHP compilation to increase page speed.
- Apart from these, the latest version has proactive caching in production mode, otherwise known as “materialization”.
Performance Optimizations in Magento 2
- Image compression has been implemented out-of-the-box to improve page loading speeds.
- The config.xml file has been slimmed down to 20% of its original size
- Zend Framework 2 has been implemented in Magento 2 to better manage the Database Layer and the Cache Engine
Page Speed Improvements in Magento 2
Out of the Box, Magento 2 is 25% faster than previous versions. One of the ways this is achieved is by reducing the number of JS calls compared to previous versions. It also pre-renders all pages into a basic HTML page (from the usual 100+ database queries) which brings down the page load times from 5 – 8 seconds in previous versions to about 1 – 2 seconds in the latest release.