3

After I update my Magento 2 installation to 2.3.2 from 2.3.1 the site caching seems not working as expected. I've double checked the FPC enabled, the site is in production mode. Still, the first response takes more than 20 seconds to the response. Here is the response header I get.

Any idea what causing this?

Please note: Here I see the expires date is earlier than the current time.

Update:

I completely disable the cache, then the loading time takes about 32.x seconds (without caching). With caching enabled it takes 20.x seconds.

Response header

5
  • 1
    what does the cache status shows you in Magento either enabled or disabled. Please also look for waterfall model if cache is enabled Jul 12, 2019 at 9:25
  • @RajMohanR Caching is enabled, What is the waterfall model? It seems each Magento response takes 20s + sometimes, I getting a feeling that it's waiting for some kind of time out and send the result.
    – Dasun
    Jul 12, 2019 at 10:39
  • Waterfall model is available in Gtmetrix report you can find what is causing the slowness. Jul 12, 2019 at 11:39
  • 1
    What is your server setup? Nginx + PHP-FPM or Apache? Have you configured Varnish for cache? Do you use your own SSL or CF one?
    – G. G.
    Jul 13, 2019 at 9:25
  • I use php fpm, without varnish. I use CF ssl. Please note this happened after updating from 2.3.1 to 2.3.2
    – Dasun
    Jul 13, 2019 at 13:13

3 Answers 3

2

After all, it was due to a MySQL timeout. I installed MySQL on the same Linux box to resolve this. I still don't understand why this happened suddenly after the update. My best bet is on Restarting my VM(droplet) @ digital ocean triggered something.

Enabling PHP FPM slow log helped me to understand the slow response due to the MySQL connection issue.

Hope this will help someone who will face the similer issue.

1
  • 1
    Restarting the Apache, PHP-FPM, and MySQL services on my server, helped me with the same problem.
    – EpixRu
    Oct 10, 2019 at 16:59
0

Try running below commands:

redis-cli -s /var/run/redis-multi-a0a405e6.redis/redis.sock FLUSHALL

NOTE: Only required some time: (Below command is different based on server, Please ask to hosting support for clear redis cache. Above is working for nexcess cloud hosting. run this command only if the redis is enabled)

php bin/magento cache:clean

rm -rf var/cache/*

rm -rf var/page_cache/*

rm -rf generated/code/*

php bin/magento setup:upgrade

php bin/magento maintenance:disable(if maintenance is enabled)

Hope this helps.

1
  • Done everything :( NO hope. This is normal Magento 2 ritual I do after an upgrade, installation. Thank you for your input.
    – Dasun
    Jul 12, 2019 at 9:17
0

CF for my opinion should bypassed. Except you have traffic from all over world. There we can discuss it. I was having these kinds of issues especially with setup:

Nginx + PHP-FPM as proxy > Varnish > Nginx SSL

  1. I think you should enable varnish with this info:

Varnish Install

  1. Use your own SSL and bypass CF
  2. Configure Nginx as proxy pass

Although if you want to keep your setup you should add to your vhost these lines:

 location ~* \.(ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ {
       expires 90d;
       access_log off;
       add_header Pragma public;
       add_header Cache-Control "public, max-age=86400";
       add_header X-Asset "yes";
   }

I am not sure if this will work with CF. For me wasn't working

5
  • Cloudflare cache is just about the best caching mechanism I've come across to date. With this enabled you dont need varnish or full page cache. Cloudflare is much more than global distribution and CDN. They can prevent DDOS. Distribute load. Plus features like rocket loader. If you can afford it use cloudflare I cant recommend them enough. Jul 13, 2019 at 19:17
  • @DominicXigen I agree! Only with paid plans as you mentioned
    – G. G.
    Jul 13, 2019 at 19:24
  • I tried Nginx proxy pass + varnish after having this error. I faced 503 error which I couldn't resolve either (with CF SSL). I Just don't get why this happened only after the update. It did work great before the update. Anyway, thanks for the input, I'll try it again with Custom SSL.
    – Dasun
    Jul 13, 2019 at 20:06
  • 1
    You should check your vhost configuration if you are getting 503 error. If you can post your vhost settings, varnish conf and nginx.conf of magento. Are you using the native one?
    – G. G.
    Jul 13, 2019 at 20:13
  • @G.G. The issue has been resolved. Delay was due to a network delay (Probably timeout or something). It seems this happened because of the restart I did to my database VM @ digital ocean. I really don't know what is the reason. Anyway, After I put everything on one Linux box resolve the issue. Slow PHP log helped me to understand that the MySQL connection is the reason for delaying. Thank you for the support!
    – Dasun
    Jul 15, 2019 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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