local cache: add lazy option to skip eager extraction on import#6573
Open
jirimoravcik wants to merge 1 commit intomoby:masterfrom
Open
local cache: add lazy option to skip eager extraction on import#6573jirimoravcik wants to merge 1 commit intomoby:masterfrom
jirimoravcik wants to merge 1 commit intomoby:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in lazy=true mode for --import-cache type=local to avoid eager “unlazying” (layer extraction) during cache import, improving rebuild performance for ephemeral/daemonless buildkitd setups.
Changes:
- Add
lazyattribute parsing to the local cache importer and use it to skipunlazyProviderwrapping. - Document the new
lazyoption in thebuildctlreference and repository README. - Update
getContentStoreto optionally return the raw session-backed content store when lazy mode is enabled.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/reference/buildctl.md | Documents --import-cache type=local,...,lazy=true usage for buildctl. |
| cache/remotecache/local/local.go | Implements lazy attribute to bypass eager unlazying by skipping unlazyProvider. |
| README.md | Adds lazy=<true|false> to local cache import option docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add a lazy=true option to the local cache importer (--import-cache type=local,src=...,lazy=true) that skips the unlazyProvider wrapping. In ephemeral/daemonless buildkitd setups, this avoids eagerly extracting all cached layers on every build. Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
223ef4d to
3021836
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When using
--import-cache type=localwith an ephemeral/daemonlessbuildkitd(one container per build), every build eagerly extracts all base image layers from the local cache — even when those layers are CACHED and don't need re-execution.With a large base image like
node:20(~350MB, 8 layers), this adds 5–10 seconds to what should be a near-instant rebuild. I've thoroughly described this in #6572.This PR fixes it by introducing
lazyparam to the local cache. If it'sfalse- default, the behavior remains unchanged. If you set it totrue, it will not perform "unlazying" on the layers, which improves the performance.Closes #6572