-
Notifications
You must be signed in to change notification settings - Fork 71
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
RFC: Opt-in Layer Caching #99
Conversation
Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
text/0000-opt-in-layer-caching.md
Outdated
[alternatives]: #alternatives | ||
|
||
- Keep current behavior. | ||
- Rename the layer directory to `<layers>/<layer>.restore/` in addition to renaming the `<layers>/<layer>.toml` files to `<layers>/<layer>.toml.restore`. This would allow the lifecycle build phase to ignore the layers instead of deleting them, (which may be desirable for performance). The rename would have to apply to both files, given that `launch = true` + `cache = false` layers don't have a `<layers>/<layer>` directory that is restored. |
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.
Was the alternative toml filename meant to be this instead?
- Rename the layer directory to `<layers>/<layer>.restore/` in addition to renaming the `<layers>/<layer>.toml` files to `<layers>/<layer>.toml.restore`. This would allow the lifecycle build phase to ignore the layers instead of deleting them, (which may be desirable for performance). The rename would have to apply to both files, given that `launch = true` + `cache = false` layers don't have a `<layers>/<layer>` directory that is restored. | |
- Rename the layer directory to `<layers>/<layer>.restore/` in addition to renaming the `<layers>/<layer>.toml` files to `<layers>/<layer>.restore.toml`. This would allow the lifecycle build phase to ignore the layers instead of deleting them, (which may be desirable for performance). The rename would have to apply to both files, given that `launch = true` + `cache = false` layers don't have a `<layers>/<layer>` directory that is restored. |
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.
I don't think I have a strong opinion, but it seems slightly more complex to rename .restore.toml
to .toml
vs. removing the .restore
suffix.
Maybe the right question is: do we intended for the file to be restored before it's used as a TOML file, or read/modified before it's restored?
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.
@sclevine Ah to clarify, I'd interpreted the "in addition" in:
Rename the layer directory to
<layers>/<layer>.restore/
in addition to renaming the
...to mean "this alternative differs in two ways from the original proposal" (both renaming the layer directory and renaming the toml file), rather than "this alternative differs in one way, and the rest is the same".
And so thought the <layers>/<layer>.toml.restore
was a typo.
Reading it back now I think the current wording is perhaps fine, I'd just misinterpreted it.
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.
👍
Signed-off-by: Stephen Levine <stephen.levine@gmail.com> Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>
text/0000-opt-in-layer-caching.md
Outdated
[alternatives]: #alternatives | ||
|
||
- Keep current behavior. | ||
- Rename the layer directory to `<layers>/<layer>.restore/` in addition to renaming the `<layers>/<layer>.toml` files to `<layers>/<layer>.toml.restore`. This would allow the lifecycle build phase to ignore the layers instead of deleting them, (which may be desirable for performance). The rename would have to apply to both files, given that `launch = true` + `cache = false` layers don't have a `<layers>/<layer>` directory that is restored. |
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.
Couldn't the builder
ignore these layers based on the name of the toml file <layers>/<layer>.toml.restore
vs <layers>/<layer>.toml
without require a rename of the directory as well?
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.
Here's the problem with that: https://github.com/buildpacks/rfcs/pull/99/files#diff-3ce8e159528f9d13f76a83a12221fed0R29
An alternative strategy: all |
@nebhale I like that idea, seems very clean. The builder would still have to remove layers though, due to: https://github.com/buildpacks/rfcs/pull/99/files#diff-3ce8e159528f9d13f76a83a12221fed0R29 |
Agreed on the deletion. If not persisting, delete it instead rather than just moving on as a no-op. |
@nebhale Idea: what if the builder moved |
@sclevine I mean, if it's spec'd someone will exploit it, but I get the point and it seems like a good idea. |
Not worried about intentional exploitation of anything, just edge cases. For example, imagine you have a |
Signed-off-by: Stephen Levine <stephen.levine@gmail.com>
Proposal updated to reflect @nebhale's suggested UX. I'm convinced that it's the best path forward, especially because it forces the buildpack to restate exactly how the layer should be cached/exposed/exported each time. |
@sclevine My point was that I'm pretty sure someone will eventually call |
Final Comment Period with merge disposition, closing on August 10, 2020. |
I understand why we want this, but it definitely feels like an advanced feature for people who maintain more complex buildpacks. The current default is probably what most people expect. If we move through with this, it would definitely require doc changes. |
@hone I wonder about the default being what they want though. In my experience proper generating and comparing enough metadata to properly determine if a layer is reused is surprisingly difficult. For example if you wanted to determine if you could re-use a compiled Java application, you'd have to compare
What I suspect is happening is that many builds are re-using layers that shouldn't be reused out in the edge cases and users, rather than opening issue about too-aggressive caching just clear the application's entire cache and lose all the value of caching for the bits that were working correctly. Given that opt-in, even for simple |
Readable.