0

I tried using Magento 2 and enabled the microcache for dynamic content for 30 minutes expiration date.

The problem is that the products from carts 'magically' get cloned in another user's cart. I was thinking that the cause was the form_key input in html that remains the same(due to FPC- microcache).

Did anyone manage to get Magento 2 to work with nginx dynamic micro-cache system?

Thanks!

2 Answers 2

0

Think of what happens, when you put microcache on top of Varnish ESI based cache.

Take the homepage for example. There are several cached objects in Varnish for it, namely:

  • homepage itself (full page cache), it will have the default TTL as you set in the backend (long term). It's "partially full page", because it will have <esi: references instead of actual blocks
  • menu ESI block. a navigational menu is already a block, this can have different TTL
  • cart ESI block, this is private ESI block and it varies by some cookie

When you apply microcache to this, on level of NGINX you have no idea which portion of the HTML is meant to be cached based on a cookie (worst case) and which should simply have smaller TTL.

It's doable at least if you vary your microcache by X-Magento-Vary to distinguish between different states/users.

In most of the sense, you have to realize that NGINX micro caching against Varnish setup will bring almost no benefit. If you cache no-cookie case, then all your speedup is the time it takes for Varnish to assemble ESI blocks, which are already all cached. Mostly same applies if you microcache by cookie value.

The one possible benefit to micro cache there would be reducing NGINX overhead of buffering responses from Varnish, especially so in a CDN setup with multiple NGINX-es.

0

as you do not publish your config, im sure your microcache config is wrong and missing some parameters, and even after you wont be able to filter all the possible cache actions.

but nevertheless Magento 2 have Varnish cache logic built-in. no extra fuss.

i would use Varnish with Magento 2. easy to maintain and no hidden issues.

2
  • Unfortunately I use engitron(nginx + apache) and the configuration is different therefore using varnish was a choice that I avoided. Commented Aug 22, 2019 at 17:53
  • then change for varnish. simple. Commented Aug 22, 2019 at 18:26

Your Answer

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.