-
Notifications
You must be signed in to change notification settings - Fork 546
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
daemon.Write
implementation is pretty naive
#205
Comments
cc @dlorenc not sure if/what of your portfolio of tools might be using This would certainly be mitigated by the local caching we've been talking about, which feels relevant to kaniko + |
I think that this could take advantage of the recently added Then we'd want to add the capacity to omit layers from the tarball via a callback here. This should avoid potential pathological behavior in the daemon, which I believe would otherwise require us to:
|
Correction: |
Mounting is just one way to take advantage of this information, so preserve as much information as we can to support other potential uses of this information. Related: google#205
This should be considered a relatively advanced option, but for folks that know what they are doing you can reduce the amount of data that you need to encode in the tarball for the daemon to load it. The ultimate use case of this option will be from `daemon.Write`, which currently uses the `docker load` interface to pull image into the daemon, however, this currently reuploads (and redownloads) the base image on each write in context like `ko`. If we can determine the set of layers that already exist in the daemon we can elide these from the tarball to dramatically improve performance. Related: google#205
Mounting is just one way to take advantage of this information, so preserve as much information as we can to support other potential uses of this information. Related: #205
cc @ekcasey is this similar to the hack you were describing? Or does imgutil do a different kind of incremental daemon loading? |
@jonjohnsonjr We also create a daemon image using the However, we know that we are extending a base that already exists in the daemon and therefore we can do a hack. We discovered we could load a tarball that omits layer blobs, when a layer with the same chain ID already exists in the daemon. Therefore, when creating images we load tarballs with a
and only includes the additional layers. This significantly speeds things up but it isn't a general case solution. This hack unfortunately can't be used to avoid reimporting layers to the daemon unless they appear in the exact same order as an existing image. |
Yeah that's what rules_docker is doing here as well. I think it's actually a really common case during development, given that you're often re-loading the same base over and over again. |
Looks like rules_docker does a linear probe of the daemon to determine what it already has -- I wonder if doing a binary search is faster, or if we expect so few layers to be shared that linear is better (since it guarantees only one miss). |
Continuation of this PR: google#209 This should be considered a relatively advanced option, but for folks that know what they are doing you can reduce the amount of data that you need to encode in the tarball for the daemon to load it. The ultimate use case of this option will be from daemon.Write, which currently uses the docker load interface to pull image into the daemon, however, this currently reuploads (and redownloads) the base image on each write in context like ko. If we can determine the set of layers that already exist in the daemon we can elide these from the tarball to dramatically improve performance. Related: google#205
Continuation of this PR: google#209 This should be considered a relatively advanced option, but for folks that know what they are doing you can reduce the amount of data that you need to encode in the tarball for the daemon to load it. The ultimate use case of this option will be from daemon.Write, which currently uses the docker load interface to pull image into the daemon, however, this currently reuploads (and redownloads) the base image on each write in context like ko. If we can determine the set of layers that already exist in the daemon we can elide these from the tarball to dramatically improve performance. Related: google#205
Continuation of this PR: google#209 This should be considered a relatively advanced option, but for folks that know what they are doing you can reduce the amount of data that you need to encode in the tarball for the daemon to load it. The ultimate use case of this option will be from daemon.Write, which currently uses the docker load interface to pull image into the daemon, however, this currently reuploads (and redownloads) the base image on each write in context like ko. If we can determine the set of layers that already exist in the daemon we can elide these from the tarball to dramatically improve performance. Related: google#205
This issue is stale because it has been open for 90 days with no |
here
Today the
daemon.Write
interface just usestarball.Write
into thedocker load
interface. While correct, this can be incredibly slow for scenarios likeko -L
because of its lack of incrementality.In particular, for a large base image we produce and stream a fat tarball to the daemon for every publish. On top of this, since we don't have a local cache wrapping
remote.Image
, we download the base image every time.remote.Write
elides both upload and download through the careful use of existence checks. We should be equally careful indaemon.Write
.One option to explore for this is what
rules_docker
did in its incremental load script. However, we should be careful to measure how this performs on a full daemon (we've seen superlinear behavior in some of the daemon calls before).The text was updated successfully, but these errors were encountered: