Batch TreeArtifact metadata through BazelOutputService - #30797
Conversation
089c2e9 to
1b573bc
Compare
|
We intentionally moved away from injecting metadata within the SpawnRunner because there are too many edge cases and we wanted skyframe to be the central place to collect metadata. For this optimization, is it possible to "inject" file/dir metadata into BazelOutputService instead? |
Keep Skyframe responsible for discovering and constructing final output metadata, but use the OutputService BatchStat implementation to obtain all TreeArtifact child statuses in one request. This avoids one output-service RPC per child without trusting metadata captured early in SpawnRunner, so later local writes and mixed remote/local tree outputs are still reflected in the final TreeArtifactValue.
1b573bc to
1fb98c8
Compare
|
Thanks — yes. I traced this back to the mixed TreeArtifact issue fixed in #16812 and removed the The revised design keeps Skyframe responsible for traversing the final TreeArtifact and constructing its This avoids stale |
coeuvre
left a comment
There was a problem hiding this comment.
Thanks, it now looks better. I will import the code.
Description
Keep Skyframe as the central place that discovers and constructs final output
metadata, while allowing
ActionOutputMetadataStoreto query anOutputServicefor allTreeArtifactchild statuses in oneBatchStatcall.When no batch statter is available, the existing per-child filesystem path is
unchanged. There is no metadata injection from
SpawnRunnerorRemoteExecutionService.Motivation
BazelOutputServicealready exposes a multi-pathBatchStat, butTreeArtifactconstruction requested every child's fast digest separately.For a lazy output filesystem, every request can cross the output-service RPC
boundary even though the service already owns the staged file and directory
metadata.
In a representative remote-output benchmark producing 4,098 files and 528 MiB
of logical output, the profile contained approximately 4,100 one-path
BazelOutputService.BatchStatcalls. An equivalent batching patch on Bazel8.5.1 produced:
This removes the RPC fanout while deliberately retaining Skyframe's final
filesystem traversal. That distinction is important for actions containing
multiple spawns or a mix of remote and local outputs: metadata is collected
from the final output-service state, rather than copied from an earlier remote
ActionResult.Build API Changes
No.
Checklist
execution optimization without user-facing configuration changes.
Validation
bazel test //src/test/java/com/google/devtools/build/lib/skyframe:ActionOutputMetadataStoreTest --test_timeout=60bazel test //src/test/java/com/google/devtools/build/lib/remote:RemoteTests --test_timeout=60bazel build //src:bazel-devThe regression test stages a nested
TreeArtifact, modifies one child beforeSkyframe collects metadata, and verifies both the final digest and exactly one
batch request containing all children.
Release Notes
RELNOTES: None