1

I have check full page cache in devdocs

when full page cache on var/page_cache generated but when varnish is enable it's not generated.

so how the both work differently. how the request work for caching.

Can anyone explain which have advance knowledge of caching.

Please read the question carefully before answering !!!!

2
  • Do you know how Varnish works in general?
    – Keyur Shah
    Commented Nov 14, 2019 at 10:49
  • @keyur Actually No!!! Commented Nov 14, 2019 at 10:51

2 Answers 2

2

Built-in cache

Magento 2 with built-in cache configuration saves full page cache content on folder in var/page_cache folder. In this type, store data in file. It means this type cache system follow file strcture to save cache data.


Varnish cache

Varnish is connect with client and your server to make things faster. When client will execute your website URL, it will first of all go to varnish (if installed) to get data of request page.

Varnish will check that if that page data will not available, then it will make a request to your actual server. Where your code, database, etc. available. When, page load will complete, server will send it back to varnish and then, varnish will store that inside its cache and then, send response to client.

After, if anyone execute that same page varnish will give response from its cache very fast.

So, we can say that it's one type reverse proxy server.

enter image description here

Short term

  • Built-in Cache : File system / Database system caching
  • Varnish : HTTP reverse proxy caching
7
  • It Means, if I have enable varnish then Built-in cache will not functioning so when varnish enable can i make all cache types disable? Commented Nov 15, 2019 at 4:34
  • In my case, generally it bypass built in cache if varnish enable. But, I would like to suggest that you should enabled built in also. Becasue, if any third module connect with cache and you will disable all cache then, it will affect to that third module. Commented Nov 15, 2019 at 9:19
  • if varnish bypassing buil in then how can will affect to third party module too. here it's not clear that varnish and built in how differently worked ... thanks for answer.. have upvoted but not accepting it because it's not clear to me yet Commented Nov 15, 2019 at 9:26
  • For example : One module get data from cache and still, if you disabled whole built in cache. Then, obviously it will return wrong output. That's why I recommended to enable built in cache however varnish installed in your server. Commented Nov 15, 2019 at 12:47
  • Now, clear or still confused? Commented Nov 15, 2019 at 12:53
0

The main difference is where the cached content is stored, varnish keeps the cached content on memory while built in will be stored in files.

Retrieving content from memory is much faster than from files but it also has some caveats f.e if you have a cluster of frontend nodes varnish will not be able to share its 'memory' between instances, the only way to achieve this without using varnish pro would be to put a proxy after varnish that would load balance requests to the frontend servers, this way, there will be only 1 varnish instance.

Now, said this, varnish has more capabilities than built-in FPC and magento team suggests using varnish for Full Page Cache.

Also please see the following question and answer: Magento 2.1 - Built-in Cache vs. Varnish Cache for Full Page Cache

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.