Magento – Magento 2: Varnish + Redis for Full Page Cache at the same time

full-page-cachemagento-2.1magento2redisvarnish

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?

Best Answer

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.