0

I have a very fast Magento 2 backend, I have configured Varnish caching. When I save any product, it takes about 20 seconds to save while loading the product edit page goes very fast. Saving category pages are also slow while saving customer data it's very fast. So it must be something with the cache invalidation I think.

The moment I switch back to inbuild cache, it's very fast again. No changes in IP's etc. I checked the cache purge IP's but it looks like there is no issue.

I have upgraded from Magento 2.1.9 to 2.3.2. Probably there's an issue. I have a fresh Magento 2 installation, on the same server that doesn't have that problem.

Also, my Varnish server is a seperate server. I host them both in Azure. They are both in different subscriptions, networks are peered. At first I thought that the problem could be a network issue but than the second Magento 2 installation should have the same problems. Both server can reach each other on port 80 and 443.

I checked varnishncsa and varnishlog, I can't find any errors.

Any idea's?

10
  • Is it a multisite? I noticed significant slow down in admin product save once more stores had been added. Checking sql and profiling it is the overhead of indexing store specific values. Only option was to configure index on schedule. Sep 19, 2019 at 20:11
  • I just remembered I created some shell scripts which I used to debug and profile a slow store. Basically perform various data actions. Check each one to confirm it's doing something you approve if you choose to run github.com/DominicWatts/Benchmark Sep 19, 2019 at 22:34
  • It's not even a multisite, just one site. Thank you for your Benchmark tool, works good on 2.3.2. I didn't test it on my live site though. Sep 20, 2019 at 10:13
  • I added an additional Varnish server in the same network, but same problems so it's not a working issue. Sep 23, 2019 at 12:26
  • Can you turn on mysql slow query log on? I'm wondering if what's happening is that you having varnish configured is adding overhead as additional queries are being used to build a cache invalidate request which is sent to varnish server. Another thing to check is a product within a single category (or perhaps no category) vs a product which is in a lot of deep categories. See if the timings match (or are similar) Sep 23, 2019 at 12:47

2 Answers 2

0

For others which are running into this problem. Then PURGE isn't working. You need to add / edit http_cache_hosts in env.php.

0

In my case, it's both http_cache_hosts and AWS security group settings. In order for varnish to need in two different servers, in the security group of varnish you should enable 6081 inbound port to Magento servers.

http_cache_hosts you can set up like (How cache clearing works with Varnish)

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

Also, do not forget to add your magento server CIDR block in acl purge section of varnish.

acl purge {
"172.31.0.0/255.255.0.0";
"localhost";

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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