How to Improve Magento 2 Performance Issues Caused by Non-cacheable Pages

- E-Commerce, Magento 2

Magento 2 export CLI

Non-cacheable pages increase page load time dramatically. The one small detail can downgrade the performance of your Magento 2 store. Consequently, neither visitors nor search engine bots will like it. In the following article, we describe how a full page cache disabled for a block on a page affects your e-commerce website. Besides, you will find how to fix the problem and restore normal settings for elements that should be cached. More useful tips are available in this blog post: Cookbook for Magento 2.

The Issue

Some store elements may be occasionally set to cacheable= “false”. This option leads to a notable performance slowdown since cache blocks are not processed as they should. Instead of being cached, they have to be loaded every time the corresponding request occurs. Since such pages have the most significant throughput, a plethora of loads takes place, providing a negative impact on Magento.

You may experience notable performance downgrade if caching is disabled for catalog and product pages. However, it is also recommended to enable this functionality for various static content, especially if it is your home page. But what makes content uncacheable?

By default, all pages support caching. It means that they are fully cacheable unless a block in a layout is uncacheable. It makes the entire page uncacheable. What makes a block uncacheable?

If a block is set to cacheable= “false”, it affects the entire page, taking it out of the caching processes.

Usually, this setting is important for pages that contain private content – various changes visible for a particular user only. For instance, private content is typical for product comparisons, shopping cart, or checkout pages.

The Solution

So, how to fix the performance issues caused by non-cacheable pages? Firstly, you need to figure out whether they include the cacheable= “false” attribute or not. Next, you need to remove it and flush the cache. If the affected pages contain private content (could not be cached normally), you can apply a slightly different technique to them. We describe it in this article: How to optimize private content blocks in Magento 2 for better performance.

If your pages don’t include the cacheable= “false” attribute, it means that other issues cause the performance slowdown. Find and fix them.  

For further information, follow this link: Slow performance due to non-cacheable pages.