on every cache flush either from cli or using System --> Cache Management -- Flush Magento Cache my frontend is down for at least 5 minutes. I cleared cache manually by clearing 1 cache at a time and I found that only when clearing "Blocks HTML output" the site goes down. Is this normal Magento Behavior. I couldn't find any error/exception in Magento logs specific to this.
block_html cache has been rebuild, the requests can take much longer than normal. This is normal, as the previously cached blocks need to be rendered again. Some of them might be heavier on performance than others. However, Magento on it's own without customization and third party modules shouldn't take 5 minutes after a simple cache clear to be ready again when running on a decent server/local machine.
Here are some tips and suggestions you could take on:
- If not already done, configure Redis & Varnish for caching. Those caching backends are superior in performance compared to Magento's default file system or database based cache.
- Check that your host system is fast enough. After clearing the cache, Magento is pretty hard on system resources. Especially disk I/O and single core performance matter. Depending on the content of your blocks, this could hardly slow down the page generation.
- Check the workload of your database. Depending on the amount of data on your shop, the database could be overloaded and being a bottleneck after a cache clear when receiving many queries.
- Check your third party modules and own customization's. Search for blocks that are cacheable. It could be possible that some block is being rendered really slow and then is cached for future requests. This would explain why the initial load of your page is that bad. In this case, only optimizing the block would deliver the wanted performance gain. The Magento 2 Profiler might help with this. You can enable it using
bin/magento dev:profiler:enable <html|csvfile>(definitely not recommended on production environments!).
- If you are having the issues on a local development environment, XDebug can have a huge performance impact when available. Removing it would help. However, you won't be able to debug anymore with it.