Cache folder is getting really large

Hi

Im running a 11ty application and cache my assets (a lot of images). My build-time is reaching uncomfortable 4-5min. My .cache folder is 5.9GB in size, while on localhost its only 1.7GB. I can’t explain that difference. I run the build clear cache, the cache-size persists at about 5.9GB. Even when I download the images in parallel, I almost and sometimes hit the max build time allowed on Netlify. I’m not quite sure how I should progress from here, because over time we will have more images and not less.

Thanks for Help and suggestions.

Hi, welcome back to the forums!

Here is a link to documentation that might help you.

You can also try lazy loading to optimize your build.

That has nothing to do with my initial post. Lazy loading? I think that reply belongs to another post than mine.

You are experiencing an issue relating to the size of your cache folder which is increasing the time it takes for your app to build correct?

You then asked for suggestion reading between the lines I assume it to decrease the build time correct? If not please clarify what exactly you are asking.

I suggested lazy loading because it can reduce the size of your cache folder for your images. Which would hopefully speed up your build. If this is not the advice or suggestions you are looking for please elaborate on your request so I can better assist you.

You are experiencing an issue relating to the size of your cache folder which is increasing the time it takes for your app to build correct?

Yes

I suggested lazy loading because it can reduce the size of your cache folder for your images. Which would hopefully speed up your build. If this is not the advice or suggestions you are looking for please elaborate on your request so I can better assist you.

Lazy loading images is a technique to load images on client side when it reached the viewport. It does not reduce the size of an image. How does that influence the time building the website?

My question is, why is my cache-folder on netlify 2-3 times larger than the one when I build the website offline on localhost. As I said, even if I “clear cache and retry with latest commit branch”, the size of the cache stays the same.

Anyone an idea for this issue?

Without your site name, I can only guess, but Netlify caches a lot more than your .cache folder - this includes Node Modules, your repo, and some other dependencies as well. 5.9 GB is a little above average size of cache, but not something to be too worried about. Most users’ builds with that or larger sized cache take a few extra seconds, and unless you’re having a high cache processing time, I don’t think there’s anything that can be done about it - except for deploying manually via CLI.