I am new to optimizing and maintaining Magento 2.2. I have an installation that are setup with:

  • Dedicated server
  • Ubuntu 16.04
  • Nginx
  • PHP 7
  • MySQL 5.7
  • Magento 2.2
  • memcached
  • Redis
  • Varnish 4

I am confused about a couple of things regarding indexing, cache & varnish and I am sorry if my questions seems stupid/weird:

  1. It seems when I make some changes i have to clear the cache in the admin and restart Varnish (service nginx restart) from the shell for the changes to be shown in the front-end. Is it supposed to be like this or can I somehow link restart of varnish with clearing of cache? Or is there something I am missing?
  2. After restart of Varnish it seems there are a "warm up" time period as customers visits the pages. I there anyway to pre-warm up varnish/cache?
  3. Prices changes frequently everyday for a lot of products and it seems that I have to re-index (and clear cache + restarting varnish) often for those prices to be shown in the front-end. Problem is the prices index takes +45 minutes and apparently makes the front-end unavaliable. The question is if there are a better way to achieve the same result?

1 Answer 1

  1. You have to tell Magento where your Varnish instance is so that it can clear the cache. The dev docs have a section on this which you can see here - http://devdocs.magento.com/guides/v2.0/config-guide/varnish/use-varnish-cache.html

For example if varnish is running on you can run

bin/magento setup:config:set --http-cache-hosts
  1. If you set up Magento to clear the Varnish cache above, it will only clear the cache for changed items (unless you flush everything which you should avoid if possible). You can use a tool like Siege to read your sitemap.xml if you want to build a little cache warming script.

  2. Magento 2 uses partial reindexing so it only reindexes changed items - this should also clear your full page cache when it completes. I believe there are some known issues with the price indexing in 2.2.

  • Hello, I have same issue that any changes regarding products are not reflect in front without restart varnish. So I used this command and it is working, but I want to ask that by doing this it will purge the varnish from my host ? I mean now varnish will not work in given host ? Commented Jun 29, 2018 at 7:09

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.