Answers.Body: <p>This sounds like asset transforms are consuming all of the space in the <code>storage</code> 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.</p>
  <p>If this is the case, using <code>craft clear-caches/assets</code> will clear the <code>storage/runtime/assets/sources</code> 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.</p>
  <p>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.</p>
  <p>If you want to prevent Craft from caching asset transforms, you can change the <code>maxCachedCloudImageSize</code> <a href="https://craftcms.com/docs/3.x/config/config-settings.html#maxcachedcloudimagesize" rel="nofollow noreferrer">config value</a> to <code>0</code>, which tells Craft not to generate a local copy of the asset transform. This ought to prevent the <code>storage</code> folder from becoming too large again.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-30T11:24:57.963Z
Answers.LastActivityDate: 2021-07-01T08:41:36.453Z
Answers.LastEditDate: 2021-07-01T08:41:36.453Z
Answers.UserDisplayName: Martin Spain
Body: <p>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 <strong>/storage</strong> folder is almost 80GB in size. All the size is in the <strong>/storage /assets</strong> folder. What command is recommended to run? <code>./craft clear-caches/all</code> or <code>./craft clear-caches/asset</code>? 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: <strong>should I run this command on both servers or just one</strong>?</p>
  <p>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.</p>
  
Tags: <craft3><assets><cache>
Title: Cache Excesive Assets Size
ThreadText: # Cache Excesive Assets Size
  
  (Asked by: username_0 on 2021-06-29)
  
  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.
  
  **Tags:** craft3, assets, cache
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-30. Score: 1 | Accepted answer
  
  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](https://craftcms.com/docs/3.x/config/config-settings.html#maxcachedcloudimagesize) 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.
  
  
  ---
  
  