Limit cache directory size?

1,935 views
Skip to first unread message

glin...@gmail.com

unread,
Apr 29, 2016, 12:37:48 PM4/29/16
to bazel-discuss
This github bug discusses the problem https://github.com/bazelbuild/bazel/issues/1035. Are there are any workarounds in the meantime?

It leads to a bad user experience, where someone does a build, and then the OS basically stops functioning when the disk is filled up.

Thanks!
Gary

Damien Martin-guillerez

unread,
Apr 29, 2016, 12:46:19 PM4/29/16
to glin...@gmail.com, bazel-discuss
Which directory get large under ~/.cache/bazel?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/95fa5ede-5533-4990-a488-f3ca225c768a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

glin...@gmail.com

unread,
Apr 29, 2016, 1:06:10 PM4/29/16
to bazel-discuss, glin...@gmail.com
It's the directories with a hash name, it's expected that they are big, our repo is about 13Gb when all built. So if you have a few different build types, debug/release, cuda/normal, it's pretty easy for things to start getting really big.

~/.cache/bazel/_bazel_gary$ du -sh *
429M 2021dd389d26a6a37740570590b2a419
20G 2435c5bc387b8ee4f83df892009d402c
36K d41d8cd98f00b204e9800998ecf8427e
11G e3bcdbb21d43958755b0b53bd6937169
15M f4d1bc7eb407a1daeb8cd0cebd9e8cda
748M install

Damien Martin-guillerez

unread,
May 2, 2016, 4:34:11 AM5/2/16
to glin...@gmail.com, bazel-discuss
So that's the output base, there is no way to limit it because then you will need to limit the number of artifact you generate. It should not grow much bigger than the total size of your built repository.

Brian Silverman

unread,
May 2, 2016, 8:59:19 AM5/2/16
to Damien Martin-guillerez, Gary Linscott, bazel-discuss
I'm pretty sure it's "total size of your built repository" * "number of (compiler, cpu, compilation_mode) tuples you use". Also, you should only have one of those per repository. You can figure out which repositories those two big ones correspond to by looking at the README file in each folder.

glin...@gmail.com

unread,
May 2, 2016, 11:15:22 AM5/2/16
to bazel-discuss, glin...@gmail.com
The problem is that it's (size of repo) x (number of build configurations), which in our case can get pretty high. In my example there, I've just done a cuda build, and a non-cuda build in the 20gb folder. If I then did a debug+optimized version, we'd get 60gb of usage. So optimally I'd like to limit the cache size to 50gb, and then when it hit that, it starts dropping older build configurations.
Reply all
Reply to author
Forward
0 new messages