-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
s3: stream a layer to s3 if possible, instead of getting it then sending it #4551
Conversation
2160862
to
8d017a2
Compare
cache/remotecache/s3/s3.go
Outdated
} | ||
if err := e.s3Client.saveMutable(ctx, key, dt); err != nil { | ||
return nil, layerDone(errors.Wrap(err, "error writing layer blob")) | ||
if int64(len(dgstPair.Descriptor.Data)) == dgstPair.Descriptor.Size && digest.FromBytes(dgstPair.Descriptor.Data) == dgstPair.Descriptor.Digest { |
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 think these digests can never have inline data. If we want to handle this case for safety then we should write a helper function (in contentutil
maybe, or maybe containerd wants it) ReaderAt(ctx, Provider, desc)
that also handles the inline data.
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.
Good point, moving this there ! (Edit: I mean trying to move things to containerd )
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.
Gaining a little bit of traction over there with a very good review simplifying the code, containerd/containerd#9657 Will update this PR if///when...
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.
Okay, containerd/containerd#9657 was recently merged. Rebasing & refreshing this.
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.
Oh, wait they are releasing a v2 it seems 🤔
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.
Yeah, don't update to v2 as part of this PR. You can leave a comment that this needs to be updated after upgrade to containerd v2 or you can just ignore this case as inline descriptor data should be impossible atm.
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.
Gotcha, I pushed a change without the inline data check and a TODO, lmk if anything
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
6b3df41
to
58c86e9
Compare
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
58c86e9
to
ac34889
Compare
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
A downstream library (s3) needs a read seeker to be able to do its own multipart upload. See: moby/buildkit#4551 Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
see moby#5584. Seems this is a regression related to moby#4551, which happen when buildkit need to export a S3 layer directly from a downloaded S3 layer. With the new wrapper, there is no exception, and buildkit download and re upload them without any issue. Checksum and size of layers are identical.
see moby#5584. Seems this is a regression related to moby#4551, which happen when buildkit need to export a S3 layer directly from a downloaded S3 layer. With the new wrapper, there is no exception, and buildkit download and re upload them without any issue. Checksum and size of layers are identical.
see moby#5584. Seems this is a regression related to moby#4551, which happen when buildkit need to export a S3 layer directly from a downloaded S3 layer. With the new wrapper, there is no exception, and buildkit download and re upload them without any issue. Checksum and size of layers are identical. Signed-off-by: Bertrand Paquet <bertrand.paquet@gmail.com>
see moby#5584. Seems this is a regression related to moby#4551, which happen when buildkit need to export a S3 layer directly from a downloaded S3 layer. With the new wrapper, there is no exception, and buildkit download and re upload them without any issue. Checksum and size of layers are identical. Signed-off-by: Bertrand Paquet <bertrand.paquet@gmail.com>
see moby#5584. Seems this is a regression related to moby#4551, which happen when buildkit need to export a S3 layer directly from a downloaded S3 layer. With the new wrapper, there is no exception, and buildkit download and re upload them without any issue. Checksum and size of layers are identical. Signed-off-by: Bertrand Paquet <bertrand.paquet@gmail.com>
Hello there !
This allows to have a more flat memory usage.
I took the insides of ReadBlob, to make it streamable:
buildkit/vendor/github.com/containerd/containerd/content/helpers.go
Lines 58 to 83 in 70db2a6
In our case the code is a little bit modified further in the sense that we allow to have 5 uploads at once, which exacerbated this even more.
The s3 uploader seems to make use of the ReadSeeker to do multipart uploads, hence why I implemented
ReadSeekerFromReaderAt
. I wish s3 would also handle ReaderAts.buildkit/vendor/github.com/aws/aws-sdk-go-v2/feature/s3/manager/upload.go
Line 577 in 8d017a2
Edit: Here are some logs with GC logs on:
Before(same image):
After: