13

My question is to Magento Pros:

Can I use Varnish and Redis for FPC (Full Page Cache) at the same time?

My current setup looks like this:

SSL termination > Varnish Full Page Cache > Apache > two Magento 2 websites.

In addition to the setup above I installed Redis for Page Cache to see if I will get any benefit from it.

What confused me is this line in Redis config:

'page_cache' =>
array(
  'backend' => 'Cm_Cache_Backend_Redis',

and here is the full code of sample Redis config I got from Magento official website:

 'cache' =>
 array(
    'frontend' =>
    array(
       'default' =>
       array(
          'backend' => 'Cm_Cache_Backend_Redis',
          'backend_options' =>
          array(
             'server' => '127.0.0.1',
             'port' => '6379'
             ),
     ),
     'page_cache' =>
     array(
       'backend' => 'Cm_Cache_Backend_Redis',
       'backend_options' =>
        array(
          'server' => '127.0.0.1',
          'port' => '6379',
          'database' => '1',
          'compress_data' => '0'
        )
     )
   )
 ),

http://devdocs.magento.com/guides/v2.0/config-guide/redis/redis-pg-cache.html

As far as I understand "page_cache" refers to Full Page Cache and I already have that in Varnish.

I checked many answers regarding Varnish, Redis and FPC in Magento 2 on this and other websites but still did not find the answer.

Question 1) Should I just remove that 'page_cache' part from the code? Or, does Varnish and Redis use different segments of FPC and I should keep it?

Question 2) Please share based on Your personal experience how well Varnish and Redis getting along in FPC in Magento 2 and would you reccomend to use both at the same time for Full Page Cache?

2
  • 1
    This question deserves better answers
    – ladle3000
    Apr 1, 2019 at 3:08
  • what did you do? i am confused with same questions. can you please answer if you found any good solutions?
    – Ashar Riaz
    Sep 17, 2019 at 22:11

2 Answers 2

5

I am using Varnish + Redis for Full Page Cache at the same time.

In Magento 2.3.2, after clear both cache, visit some pages, then you will find the database in Redis for page cache will not have any data.

So if you are using Varnish cache, Full Page Cache will not use the page_cache setting from env.php. If you remove Varnish, Full Page Cache will use the Redis again.

After my test, when I remove the page_cache part from the file env.php, there was no page load speed improvement, the load time is the same. So my answer is:

Question 1) Doesn't need to remove that 'page_cache' part from the code, there is no difference whether it is removed or not.

Question 2) In my personal experience, I removed the 'page_cache' part from the code, just for keeping the config codes clean in env.php.

3

Yes, you should just remove 'page_cache' part from the code.

In case you keep it, nothing so bad would happen.

In my own testing, both continue working and what's most important, both Redis and Varnish cache are still being invalidated once you're update your content.

No real benefit though.

0

Your Answer

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

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