Why not use and share disk_cache?

42 views
Skip to first unread message

Caleb Fujimori

unread,
Oct 4, 2024, 3:31:40 AMOct 4
to bazel-discuss
Hi All,

The local disk cache seems like a no-brainer to use, so I'm surprised it's not enabled by default.

1. Is there any reason not to use it?

> You can pass a user-specific path to the --disk_cache flag using the ~ alias (Bazel will substitute the current user's home directory). This comes in handy when enabling the disk cache for all developers of a project via the project's checked in .bazelrc file.

2. This is also backwards from what I'd expect. If you are sharing a machine with other users building the same repositories why  would you not want to share the same build cache?

Thanks,
Caleb

Chuck Grindel

unread,
Oct 4, 2024, 10:20:49 AMOct 4
to bazel-discuss
Enabling the disk cache for machines that people use is generally helpful. It can speed up builds, especially if you switch branches often. However, it is less valuable when running builds in an automated setting (e.g., CI). A highly available remote cache is much more important for these cases because you typically have a fleet of machines that may have a short lifetime (e.g., GitHub Actions). 

The other reason not to enable it by default is that it will grow unbounded. An unsuspecting user could be surprised at how much disk space the disk cache can take up. Tracking issue.

David Turner

unread,
Oct 5, 2024, 12:46:03 PMOct 5
to Caleb Fujimori, bazel-discuss
On Fri, Oct 4, 2024 at 9:31 AM Caleb Fujimori <caleb.f...@gmail.com> wrote:
Hi All,

The local disk cache seems like a no-brainer to use, so I'm surprised it's not enabled by default.

1. Is there any reason not to use it?

I have it enabled for my builds, but from experience I can tell you that it fills up pretty quickly, and you have to manually clear it after some time . That may be one reason to not make this a default.

> You can pass a user-specific path to the --disk_cache flag using the ~ alias (Bazel will substitute the current user's home directory). This comes in handy when enabling the disk cache for all developers of a project via the project's checked in .bazelrc file.

2. This is also backwards from what I'd expect. If you are sharing a machine with other users building the same repositories why  would you not want to share the same build cache?


 
Thanks,
Caleb

--
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/0723a500-1ea5-4398-80e0-ad7c31e59fcfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages