1

I am using Magento EE 2.1.1 and FPC is enabled (built-in).

What I suppose is, if any page(homepage, category or product pages) is accessed next time, Magento should dispatch whole page content from the cache. But this is not happening. I can see many individual blocks are getting rendered.

Can anyone shed some light on it, please?

  • Is it normal behaviour? or a bug in Magento EE 2.1.1
  • Will full page only be cached in the case of Varnish instead of built-in FPC?

NOTE: The value of HTTP header X-Magento-Cache-Debug is always MISS

Rafael Corrêa Gomes
13.9k15 gold badges92 silver badges190 bronze badges
asked Oct 10, 2017 at 19:40
2
  • What does your bin/magento binary tell you? Is FPC enabled entirely? Or are some settings set up to not cache? I also see you have a http header with a debug rule, this implies you're not running production, maybe there's a distinct difference there? Also, Varnish is the default FPC for Magento 2 EE . It's actually quite expensive to cache punch cached pages in Varnish which is a shame really. Last thing: have you made sure Varnish is working properly? Commented Oct 13, 2017 at 7:53
  • I am not sure what you mean by ' What does your bin/magento binary tell you?' and FYI, I am using in-built FPC. Commented Oct 13, 2017 at 10:42

2 Answers 2

8

Most common issue is a block included in all pages with cacheable = false. Maybe an extension with this declaration in default.xml. See vendor/magento/framework/View/Layout.php, function isCacheable.

In particular:

`$this->getXml()->xpath('//' . Element::TYPE_BLOCK . '[@cacheable="false"]')`

To debug page load and save, see bellow. But before it, I would start with the above.

The page is loaded/saved from page cache type with these entry points:

vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php

vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php

This class is an around plugin on vendor/magento/framework/View/Result/Layout.php , renderResult function. Layout is a more complex version of vendor/magento/framework/Controller/Result/Raw.php. Raw builds a page in a string ($content = 'All that it is';). Layout builds the page using XML layout (a tree of blocks/ a tree of strings).

All plugins contain straight forward code and there is no need for further code explanation. Cache is HIT when the page is found in cache. If not in cache, than it allows the application to build the content (html; there is a check that JSON should not be cached, ..) and saves in cache page's html for the next time.

In the 2 plugins (FrontController mostly) you can start debugging and see when it fails. The cause of your issue will be exposed by other parts of the code and to me it looks like it's caused by your setup.

If anything, there is a fix in Kernel.php https://github.com/magento/magento2/commit/861f596371825d9e24672cd613229ae9486c635f I personally find it odd.

answered Oct 13, 2017 at 7:39
0

If the bin/magento command will tell you the full page cache is enabled and the admin displays it as disabled you may just need to restart php-fpm to reload the OPcache since its loading that setting from the filesystem. The .env file also tells Magento to set the right varnish headers and if it's not loading that the full page cache won't work properly.

Sometimes I've had an extension installation set the full page cache setting in the .env file to 0 instead of 1. Making cacheable page load times go from sub 100ms to over 1000ms.

Make sure the .env file has 'full_page' => 1, then reload php-fpm or if you need it immediately restart php-fpm

answered May 19, 2020 at 21:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.