Skip to content

compression: add support for the zstd algorithm#363

Merged
rhatdan merged 1 commit intocontainers:masterfrom
giuseppe:zstd
Jun 20, 2019
Merged

compression: add support for the zstd algorithm#363
rhatdan merged 1 commit intocontainers:masterfrom
giuseppe:zstd

Conversation

@giuseppe
Copy link
Copy Markdown
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 gscrivan@redhat.com

@giuseppe
Copy link
Copy Markdown
Member Author

giuseppe commented Jun 7, 2019

PR for c/image: containers/image#639

@nalind
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

ready for review

"github.com/DataDog/zstd"
)

func zstdReader(buf *bufio.Reader) (io.ReadCloser, error) {
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.

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

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.

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
Copy Markdown
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 <gscrivan@redhat.com>
@nalind
Copy link
Copy Markdown
Member

nalind commented Jun 20, 2019

LGTM

1 similar comment
@rhatdan
Copy link
Copy Markdown
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