executor: allow using overlayfs for action workspaces #4330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new flag
--executor.workspace.overlayfs_enabled
which enables overlayfs for action workspaces and another flag--executor.workspace.overlayfs_anonymous_only
to enable it only for anonymous users (which may be preferable when already using group-level filecache isolation for authenticated users). This provides an alternative to reflinking to get copy-on-write for action inputs.The behavior of this flag is:
{path}.lower
- inputs will go in this dir and cannot be overwritten by actions{path}.work
(for overlayfs temp data) and{path}.upper
(for changes){path}
workspace
package to be minimal. All we have to do is hardlink inputs to the{path}.lower
dir. Everywhere else (e.g. action working directory, uploading action outputs), we can still useworkspace.Path()
to get the action working directory, which points to the overlayfs mount dir and is where the action should be reading and writing files.dirHelper
for downloading inputs and uploading outputs, it simplifies the code so thatdirHelper
can always just be working fromlowerdir
instead of downloading inputs from lowerdir and uploading from the mount dir.Benchmark results (from GCP VM matching current executor configuration)
Results from a simple build (overlayfs is about 20% slower):
I checked to see if there are any knobs available that would help improve performance - I found the
volatile
mount option but it didn't measurably affect performance (it seems to be more applicable to some niche workloads which do a lot offsync
operations - the article mentions "Certain tools like RPM call for a sync after every file is written to disk").Related issues: https://github.com/buildbuddy-io/buildbuddy-internal/issues/2441