Skip to content
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

compression: add support for the zstd algorithm #363

Merged
merged 1 commit into from
Jun 20, 2019

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jun 7, 2019

zstd is a compression algorithm that has a very fast decoder, while
providing also good compression ratios. The fast decoder makes it
suitable for container images, as decompressing the tarballs is a very
expensive operation. This is a first step at supporting zstd as we We
don't yet generate zstd layers.

In my testing, copying the Fedora image from a local dir: repository,
the wall clock time passed from ~8s with gzip compression to ~4.5s
with zstd.

Signed-off-by: Giuseppe Scrivano [email protected]

@giuseppe
Copy link
Member Author

giuseppe commented Jun 7, 2019

PR for c/image: containers/image#639

pkg/archive/archive.go Outdated Show resolved Hide resolved
@nalind
Copy link
Member

nalind commented Jun 7, 2019

Modifying pkg/archive/archive.go requires a second commit that updates archive_ffjson.go.
The new dependency also needs to be added to our top-level vendor.conf.

@giuseppe
Copy link
Member Author

giuseppe commented Jun 7, 2019

Modifying pkg/archive/archive.go requires a second commit that updates archive_ffjson.go.
The new dependency also needs to be added to our top-level vendor.conf.

I've added the dependency, the generated archive_ffjson.go doesn't change

@giuseppe giuseppe changed the title compression: add support for the zstd algorithm [WIP] compression: add support for the zstd algorithm Jun 7, 2019
@giuseppe giuseppe force-pushed the zstd branch 4 times, most recently from 672e3e9 to 61bf0da Compare June 11, 2019 15:11
@giuseppe giuseppe changed the title [WIP] compression: add support for the zstd algorithm compression: add support for the zstd algorithm Jun 13, 2019
@giuseppe
Copy link
Member Author

ready for review

"github.com/DataDog/zstd"
)

func zstdReader(buf *bufio.Reader) (io.ReadCloser, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Why does this expect a *bufio.Reader instead of an io.Reader?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had left that as with unbuffered input I see very bad compression results.

But I guess it is better to be more generic, I've changed it to io.Reader.

"io"
)

func zstdReader(buf *bufio.Reader) (io.ReadCloser, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Why does this expect a *bufio.Reader instead of an io.Reader?

zstd is a compression algorithm that has a very fast decoder, while
providing also good compression ratios.  The fast decoder makes it
suitable for container images, as decompressing the tarballs is a very
expensive operation.  This is a first step at supporting zstd as we We
don't yet generate zstd layers.

In my testing, copying the Fedora image from a local dir: repository,
the wall clock time passed from ~8s with gzip compression to ~4.5s
with zstd.

Signed-off-by: Giuseppe Scrivano <[email protected]>
@nalind
Copy link
Member

nalind commented Jun 20, 2019

LGTM

1 similar comment
@rhatdan
Copy link
Member

rhatdan commented Jun 20, 2019

LGTM

@rhatdan rhatdan merged commit 4105670 into containers:master Jun 20, 2019
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.

3 participants