-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[7.4.0] Implement disk cache garbage collection. #23833
[7.4.0] Implement disk cache garbage collection. #23833
Conversation
The garbage collection policy is defined by a maximum target size and a maximum age of individual cache entries, both of which may be simultaneously provided. I/O operations are parallelized to improve performance for large caches or slow filesystems. PiperOrigin-RevId: 677860078 Change-Id: Ib342ad5e80ef4ef4af237aae243a300d13caaa06
PiperOrigin-RevId: 678351425 Change-Id: I86caf1d0fd8d1da209bbaae760f06e963a7d94b9
… around the disk cache. PiperOrigin-RevId: 678765547 Change-Id: I3a77a2eb32cb2972a54f0574d70c0b9e58d35f04
With this change, Bazel becomes able to automatically garbage collect the disk cache while idle. The idle delay is controlled by --experimental_disk_cache_gc_idle_delay, while the collection criteria are set by --experimental_disk_cache_gc_max_{size,age}. At least one of the latter must be set for a collection to take place. An end-to-end test will be added in a followup. PiperOrigin-RevId: 679078545 Change-Id: Ic86e795c384a1502af675f00f9db8b5777a6adff
…ction run. PiperOrigin-RevId: 679111203 Change-Id: If8ecf6c0881e410506358725943bc8cc49d8533e
…efore CAS entries with the same age. PiperOrigin-RevId: 679138266 Change-Id: I6eadf1b872b4adaece69e56fd3977088634a348f
…arbage collection. PiperOrigin-RevId: 679173101 Change-Id: I3a095a420e7933c4f4073c2f8d19e3b9b13fda5c
This might be useful to users who desire more control over when garbage collection runs. It also makes it easier to benchmark, since the facilities built into Bazel aren't capable of profiling idle tasks. PiperOrigin-RevId: 679287940 Change-Id: Ib08bff105c2674f9d63ef57181805af30bbc0254
The ExecutorService created in RemoteModule#beforeCommand is intended to have command scope, so it won't be available during idle periods. (The current state doesn't work, either, because we pass it into the DiskCacheGarbageCollectorIdleTask before initializing it. Oops.) PiperOrigin-RevId: 679497012 Change-Id: I8e791580c2db078c6d39cb760936b8fbcba4ed3d
PiperOrigin-RevId: 679550494 Change-Id: Ie397d3e498423ce1dd121e786c8e8e129bcb87f2
…ion of automatic garbage collection. PiperOrigin-RevId: 679593657 Change-Id: I4f5aa03d88913702ab4c1b879bc2bc9b0c40f720
PiperOrigin-RevId: 680491370 Change-Id: Ia3454a60296fa183e59b0fde8c41da42ef75aba5
PiperOrigin-RevId: 680521067 Change-Id: I6c018eeaf73d8c7d8763774dad609c450faa87ac
…tsubmits. PiperOrigin-RevId: 680537609 Change-Id: I1f32f299928922164c6b7924638bc6efc5655ff1
Unlikely to matter, but technically has better performance under contention. PiperOrigin-RevId: 680917850 Change-Id: I1a26f01d9e092427634f725bd2211c272500aecc
The earlier fix in 6922734 is wrong on Linux, where the native encoding is indicated by the sun.jnu.encoding property, and could be something other than UTF-8. Closes bazelbuild#23817. PiperOrigin-RevId: 680947021 Change-Id: Idd52c1615de6edf423f59b62e364f0b7131f2d47
… disk cache entry. This reduces the window for a race condition with a concurrent build. (We don't need to close it completely, as Bazel has the ability to retry a build on a cache eviction.) PiperOrigin-RevId: 680963998 Change-Id: I474f192e93da5cf98333ec9e211b3abae95f7b69
f100079
to
53839d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Thanks ya'll for all the work on getting this into Bazel 7! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bazelci/postsubmit.yml
@@ -18,6 +18,7 @@ tasks: | |||
- "//src:bazel_jdk_minimal" | |||
- "//src:test_repos" | |||
- "//src/main/java/..." | |||
- "//src/tools/diskcache/..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bazelci/postsubmit.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/BUILD
@@ -64,6 +64,8 @@ | |||
import com.google.devtools.build.lib.remote.circuitbreaker.CircuitBreakerFactory; | |||
import com.google.devtools.build.lib.remote.common.RemoteCacheClient; | |||
import com.google.devtools.build.lib.remote.common.RemoteExecutionClient; | |||
import com.google.devtools.build.lib.remote.disk.DiskCacheClient; | |||
import com.google.devtools.build.lib.remote.disk.DiskCacheGarbageCollectorIdleTask; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/BUILD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bazelci/presubmit.yml
@@ -15,12 +15,17 @@ java_library( | |||
name = "disk", | |||
srcs = glob(["*.java"]), | |||
deps = [ | |||
"//src/main/java/com/google/devtools/build/lib/concurrent", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/java/com/google/devtools/build/lib/remote/disk/BUILD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/java/com/google/devtools/build/lib/remote/disk/DiskCacheClient.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bazelci/postsubmit.yml
"//src/main/java/com/google/devtools/build/lib/vfs", | ||
"//third_party:flogger", | ||
"//third_party:guava", | ||
"//third_party:jsr305", | ||
"//third_party/protobuf:protobuf_java", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bazelci/postsubmit.yml
By cherry-picking the following changes: