Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disk usage on OS X for cache is ridiculously large #7909

Closed
adamreisnz opened this issue Feb 15, 2020 · 10 comments
Closed

Disk usage on OS X for cache is ridiculously large #7909

adamreisnz opened this issue Feb 15, 2020 · 10 comments
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+.

Comments

@adamreisnz
Copy link

adamreisnz commented Feb 15, 2020

Bug description

Yarn is using way too much cache

What is the current behavior?
By accident really, I found out that yarn was using more than 10GB of disk space on my computer for caches.

How on earth it even managed to accumulate 10GB worth of cached data is beyond me. I don't even think that if you add up the size of every single package that I ever installed + their dependencies and multiply it by 100 you'd get there.

What is the expected behavior?
For yarn to manage the cache better, purge old items from the cache, clean up after itself, and be a better guest on my machine in general. Put a limit on how much can be cached. 1GB should be plenty! And surely packages that were cached a year ago can be purged from cache as well.

Steps to Reproduce

  1. Use yarn for a couple of years
  2. Check your cache size

Environment

  • Node Version: 12
  • Yarn v1 Version: 1.21.0, but I've been using it since 0.x
  • OS and version: OS X 10.14.6
@adamreisnz adamreisnz changed the title Cache size on OS X Disk usage on OS X for cache is ridiculously large Feb 15, 2020
@velipso
Copy link

velipso commented Aug 17, 2020

I have to remove mine yearly... last year it hit 96GB (on a 250GB ssd), and this year it was 70GB. Fun times.

Also, I have to literally rm it, because yarn cache clean will crash V8.

If anyone is curious:

cd ~/Library/Caches/Yarn
rm -rf *

@velipso
Copy link

velipso commented Aug 17, 2020

this is probably a symptom of #6037

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

Closing as fixed in v2 where the cache uses compressed zip files

https://yarnpkg.com/getting-started/migration

@merceyz merceyz closed this as completed Jan 2, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 2, 2021
@adamreisnz
Copy link
Author

10GB compressed as ZIP file is still going to be huge. Is there not better way of managing the cache and auto purging old cache files more frequently?

@merceyz
Copy link
Member

merceyz commented Jan 3, 2021

That's fair, yes, but the amount of files is much smaller (1 file = 1 dependency) and the amount of dependencies you'll need to download to get to that is much higher. For example my current cache contains 18542 dependencies (and thus 18542 files) at 3.71GB.

If auto cleaning the cache is something you need in v2 make a feature request

@adamreisnz
Copy link
Author

I already filed a ticket for the issue, it's this one. I don't think zipping is the answer here. But if you deem it solved and closed, then that's up to you and the Yarn team to decide.

@mariusbutuc
Copy link

FWIW, before yarn cache clean = 3.3 GB:

yarn_cache_-_before_clean___DaisyDisk

after yarn cache clean = all clean:

yarn_cache_-_after_clean___DaisyDisk

@shivaylamba
Copy link

@mariusbutuc what software did you use to display this graphical representation, looks really cool

@adamreisnz
Copy link
Author

It's called daisy disk

@shivaylamba
Copy link

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+.
Projects
None yet
Development

No branches or pull requests

5 participants