cancel
Showing results for 
Search instead for 
Did you mean: 

Varnish vs Redis Caching differnce in Magento2

SOLVED

Varnish vs Redis Caching differnce in Magento2

Currently we are using redi backend for defult and page cache in magento2.  The env.php can be find below. 

'cache' => [
'frontend' => [
'default' => [
'id_prefix' => 'def_',
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => '**********',
'database' => '1',
'port' => '6379',
'password' => ''
]
],
'page_cache' => [
'id_prefix' => 'def_',
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => '**********',
'database' => '2',
'port' => '6379',
'compress_data' => '0',
'password' => ''
]
]
]

We introduced varnish from admin side by changing store settings. While checking varnish is hitting with cache but couldn't find any configuration changes on env.php

Should I remove page_cache section from the env.php or still it's redqired?

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Varnish vs Redis Caching differnce in Magento2

Hello @Vineethekm 

 

if you are using varnish cache then it will not use the page_cache tag from env.php

 

but if you  are not using varnish then it will use.

 

but if you are using varnish cache then you need to add

 'http_cache_hosts' => [
        [
            'host' => '52.43.192.118',
            'port' => '80'
        ]
    ],

Hope it will clear your doubts, if works then mark as a solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

3 REPLIES 3

Re: Varnish vs Redis Caching differnce in Magento2

Hello @Vineethekm 

 

if you are using varnish cache then it will not use the page_cache tag from env.php

 

but if you  are not using varnish then it will use.

 

but if you are using varnish cache then you need to add

 'http_cache_hosts' => [
        [
            'host' => '52.43.192.118',
            'port' => '80'
        ]
    ],

Hope it will clear your doubts, if works then mark as a solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Varnish vs Redis Caching differnce in Magento2

Thank you @Sunil Patel. Much appreciated. 

 

This is the step to add that conf by CLI.

./magento setup:config:set --http-cache-hosts=127.0.0.1,127.0.0.1:6081 Conf:- 

'http_cache_hosts' => [
[
'host' => '127.0.0.1'
],

Re: Varnish vs Redis Caching differnce in Magento2

@Vineethekm 

 

ya you can set backend host for varnish using command that is good Smiley Happy 

 

make sure you need to download vcl file from admin you need to configure it for varnish

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer