Skip to content

Add simultaneous unpack support#2918

Merged
crosbymichael merged 2 commits intocontainerd:masterfrom
Random-Liu:parellel-unpack
Aug 23, 2019
Merged

Add simultaneous unpack support#2918
crosbymichael merged 2 commits intocontainerd:masterfrom
Random-Liu:parellel-unpack

Conversation

@Random-Liu
Copy link
Copy Markdown
Member

For #2886.

Time consumed to pull k8s.gcr.io/kube-cross:v1.10.3-1 on my machine:

@Random-Liu Random-Liu added this to the 1.3 milestone Jan 9, 2019
@Random-Liu Random-Liu mentioned this pull request Jan 9, 2019
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 9, 2019

Codecov Report

Merging #2918 into master will decrease coverage by 0.87%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2918      +/-   ##
==========================================
- Coverage   42.29%   41.41%   -0.88%     
==========================================
  Files         126       70      -56     
  Lines       13871     9457    -4414     
==========================================
- Hits         5867     3917    -1950     
+ Misses       7118     4979    -2139     
+ Partials      886      561     -325
Flag Coverage Δ
#linux ?
#windows 41.41% <ø> (+4.15%) ⬆️
Impacted Files Coverage Δ
snapshots/native/native.go 1.78% <0%> (-41.27%) ⬇️
archive/tar.go 16.99% <0%> (-30.97%) ⬇️
archive/tar_opts.go 28.57% <0%> (-30.26%) ⬇️
metadata/snapshot.go 21.53% <0%> (-26.38%) ⬇️
metadata/leases.go 44.27% <0%> (-6.98%) ⬇️
metadata/gc.go 61.35% <0%> (-5.41%) ⬇️
errdefs/grpc.go 75% <0%> (-2.5%) ⬇️
oci/spec_opts.go 26.8% <0%> (-2.41%) ⬇️
remotes/docker/authorizer.go 68.2% <0%> (-2.33%) ⬇️
content/local/writer.go 56.86% <0%> (-1.8%) ⬇️
... and 85 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd46ea5...03aafaa. Read the comment docs.

pull.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about return NewImageWithPlatform(c, img, pullCtx.PlatformMatcher), nil

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pull.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that it doesn't consider the manifest list(index) case, for example, pull hello-world:latest with --all-platform, if my understanding is correct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull only supports one platform, see https://github.com/containerd/containerd/blob/master/client.go#L377.

I can add a comment to explain this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pull.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about ctx.Err() instead of errors.New("context cancelled")? it might be closed by deadline.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pull.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we filter by the mediatype? it is easy to break if dependence on the order.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@AkihiroSuda
Copy link
Copy Markdown
Member

needs rebase

@AkihiroSuda
Copy link
Copy Markdown
Member

Any update?

@AkihiroSuda
Copy link
Copy Markdown
Member

needs rebase

@Random-Liu Random-Liu force-pushed the parellel-unpack branch 4 times, most recently from f581cc6 to 94d0a60 Compare July 31, 2019 21:45
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 31, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Jul 31, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 1, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 9, 2019

Build succeeded.

@crosbymichael crosbymichael requested a review from dmcgowan August 12, 2019 16:58
unpacker.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be some check here that the image and chain ID are aligned. I think my preference would be that instead of just returning the chain, return a combination of chain and config, then use the config directly from there.

Copy link
Copy Markdown
Member Author

@Random-Liu Random-Liu Aug 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that we don't have config for schema1 until convert is done.

Copy link
Copy Markdown
Member Author

@Random-Liu Random-Liu Aug 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added validation.

This is bitter sweet to me. I hate the code structure, but to support schema1 I have to do it in this way. :(

Added a TODO for the cleanup after schema1 support removal.

@Random-Liu Random-Liu force-pushed the parellel-unpack branch 2 times, most recently from 2fdfa51 to 10c756b Compare August 12, 2019 22:32
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 12, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 12, 2019

Build succeeded.

unpacker.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do nothing for manifest list instead of sending invalid layer.

Copy link
Copy Markdown
Member Author

@Random-Liu Random-Liu Aug 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip the manifest list.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Random-Liu
Copy link
Copy Markdown
Member Author

Offline discussed with @dmcgowan, I'm going to drop the schema1 support and cleanup the code.

As a followup, we can also add manifest list support, but that would be a following PR I think @dmcgowan

@Random-Liu
Copy link
Copy Markdown
Member Author

@dmcgowan Removed schema 1 support, and cleaned up the code.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 20, 2019

Build succeeded.

pull.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The target shouldn't have this media type. Instead is there a way to just see if the simultaneous unpacker didn't perform any unpacks, then try and do it synchronously

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, the image was converted already. My bad.

Let me see.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use an atomic counter on the number of unpack calls

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added an atomic int unpacks.

Signed-off-by: Lantao Liu <lantaol@google.com>
Signed-off-by: Lantao Liu <lantaol@google.com>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Aug 21, 2019

Build succeeded.

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Aug 23, 2019

LGTM

I had to make some changes to ctr to test it there. There needs to be more thought to getting this working correctly in ctr as well as supporting multiple platforms. We can focus on this for 1.4.

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit 4a2f61c into containerd:master Aug 23, 2019
@Random-Liu Random-Liu deleted the parellel-unpack branch August 23, 2019 20:54
@Random-Liu
Copy link
Copy Markdown
Member Author

Thanks for reviewing!

@yxxhero
Copy link
Copy Markdown

yxxhero commented May 22, 2025

What are the basic conditions needed to use this feature? Thank you so much. @Random-Liu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants