Skip to main content

Varnish

Magento2- How Magento cache clearing works with Varnish

According to Varnish documentation, “A purge is what happens when you pick out an object from the cache and discard it along with its variants.” A Varnish purge is very similar to a Magento cache clean command (or clicking Flush Magento Cache in the Magento Admin).

In fact, as discussed in this section, when you clean, flush, or refresh the Magento cache, Varnish purges as well.

 

Configure Magento to purge Varnish

execute this code 

bin/magento setup:config:set --http-cache-hosts=192.0.2.100,192.0.2.155:6081

Showing the total of the loaded time of the page

If you want to see the total loaded time for any page to compare the time between the first and second time you can use this command 

 

curl -L --output /dev/null --silent --show-error --write-out 'lookup:        %{time_namelookup}\nconnect:    %{time_connect}\nappconnect:    %{time_appconnect}\npretransfer:   %{time_pretransfer}\nredirect:      %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal:      %{time_total}\n' 'https://www.example.com/'