1

I have only been using Craft 3 for a short time and I am currently the webmaster of a too big news site. I just checked that the /storage folder is almost 80GB in size. All the size is in the /storage /assets folder. What command is recommended to run? ./craft clear-caches/all or ./craft clear-caches/asset? And what is the impact it would have on the performance of the site? The site uses a load balancer and this raises another question for me: should I run this command on both servers or just one?

All images uploaded to the site are stored on an Amazon S3. The servers are reaching the limit of space because of this, I am desperate.

1

This sounds like asset transforms are consuming all of the space in the storage directory. Asset transforms take the original asset from the S3 bucket and transform it (resize, crop etc.) for use in various pages on the site. However, while the newly-transformed asset gets saved to the S3 bucket, it's also cached on the local server. With a big enough site and lots of images, that cache folder will fill up pretty quickly.

If this is the case, using craft clear-caches/assets will clear the storage/runtime/assets/sources directory where the asset transforms are saved by default. You'd need to run it on both servers, too, because each server behind the load balancer will be generating its own version of these asset transforms as requests are routed to it.

Before you run it, just to be on the safe side, I'd confirm that the asset transforms are definitely being saved to the S3 bucket, and are being served to the page from there, not the local directory.

If you want to prevent Craft from caching asset transforms, you can change the maxCachedCloudImageSize config value to 0, which tells Craft not to generate a local copy of the asset transform. This ought to prevent the storage folder from becoming too large again.

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.