0

I'm using Magento2 & my concern is here:-

If I set CRON for indexing(every 12th minutes) & cache-flush(every hour) will it affect website speed?

is it the right way to use cache via CRON?

What can I set in CRON?

Here is the screenshot:-

http://nimb.ws/L2MuVO

Any help will be appreciated.

2

Yes, it will.

Simply because of 2 reasons:

  1. Indexing is a very costly process that uses very much memory & CPU power. A large collection (10 to 100.000 products) can easily take 10-15 minutes to complete. You could even potentially start your indexer again before the first one is even completed!

  2. Cache is intended to take some load of your server. If you flush your cache every hour, this means that every hour the cache needs to be re-build again, which in term consumes memory and CPU power.

Needless to say: when memory and CPU power are taken by indexing and caching issues, there is less to spare for your regular visitors. So yes: it will affect performance.

But:

It seems to me that you're trying to implement the wrong answer to your problem. I assume there is some process / code in your site that does not work properly and to you it seems to be fixed if your run the reindexers and flush the cache.

However: Magento 2 has some very nifty mechanisms built-in that mark a single product for re-indexing and cache invalidation when it's mutated (an event triggers this). So it seems to me that you have a process that's mutating these entities outside the lifecycle of Magento (perhaps you have an import process of some kind that directly executes SQL-queries on your product table in the database instead of going through the repositories).

So I think you're better of fixing the underlying issue instead of just patching it. After all: if a ship is making water, you're not just only using buckets to get rid of the water, but you also need to fix the hole. Trying to solve your issue with only permanently running indexers and cache flushing is like only getting rid of the water, but without fixing the hole.

Good luck!

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.