Magento – Catalog Product Media Cache 44 gb

cachemagento2server-setupvarnish

My magento 2.2 site has stopped running because the server instance it is hosted on has run out of storage space, I have looked into what is causing this and found that the pub/media/catalog/product/cache folder is over 40GB large, I am unable to run a catalog reindex as the is no writing space available on my instance. Varnish has been returning a 503 error since.

I have over 20,000 products with each 2-3 images attached to them.

I have disabled cron and have been running manual reindexing and cache clearing.

Is it safe to delete that folder and assume that the cache would be regenerated, or would you have a better approach to handling this? I don't want to lose recent data.

Best Answer

Is something to try, note have NOT used it and not endorsing but others mentioning duplicating product data in 2.x Issues have mentioned it.

Reference:

Blindly just removing the /product/cache directory means that all previously generated image resizing will happen again, and at 20k products that will take awhile. The tool above should help remove duplicates however if there is a core bug in 2.2 or a 3rd party module being used you'll eventually need to run the clean up again. Look to address the source if you do have duplicates.

IF no duplicates your only real option is more server space or using something like:

To optimize your product images that should not effect their quality but removing things like meta data and performing other optimizations.

Related Topic