Skip to content

Added parallel gzip.#34788

Closed
jboero wants to merge 1 commit intomoby:masterfrom
jboero:34787-pigz
Closed

Added parallel gzip.#34788
jboero wants to merge 1 commit intomoby:masterfrom
jboero:34787-pigz

Conversation

@jboero
Copy link
Copy Markdown

@jboero jboero commented Sep 8, 2017

See #34787
Parallel gzip via pigz external binary greatly accelerates compression/decompression.

Signed-off-by: John Boero [email protected]

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

See moby#34787
Parallel gzip via pigz external binary greatly accelerates compression/decompression.

Signed-off-by: John Boero <[email protected]>
@odeke-em
Copy link
Copy Markdown

Thank you @jboero for the PR and for the feature request!

I am assuming that this PR is still in progress as we haven't yet made the
comparison/benchmark report that @AkihiroSuda requested in #34787 (comment)
to compare pigzip exec'd, with https://github.com/klauspost/pgzip.

Another suggestion I have is perhaps for the title and future easy auditing and inspection of commits:

  1. Could we update the commit message to something like this
pkg/archive: add pgzip exec'd as an option for image decompression

Fixes #34787

Parallel gzip via pigz external binary invoked by os/exec
greatly accelerates compression/decompression.
Add this option as toggleable.

Thank you.

Comment thread pkg/archive/archive.go

func pigzDecompress(archive io.Reader) (io.ReadCloser, <-chan struct{}, error) {
args := []string{"unpigz", "-c"}
return cmdStream(exec.Command(args[0], args[1:]...), archive)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not thrilled with the idea that the user needs to install additional packages (in this case only unpigz) to get this feature. Maybe https://github.com/klauspost/pgzip is sufficient enough.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here... I even didn't know that unpigz was existing!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry for the delay - didn't notice this. I think it's nicer to rely on the already hardened and maintained pigz (which uses standard glibz) rather than another piece of Go code that reinvents the wheel. The default behavior for an environment missing pigz/unpigz is just to fallback on the standard zip anyway. I think it's more odd to make users download another implementation of gzip when they likely already have it. Pigz/unpigz is a tiny 114K app that just threads out libz.

Anyway I just tried it out as a PoC so if someone wants to implement it in a supported method with golang, it would make good sense to add both parallel zip and unzip together as was already requested.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

In the Fedora packaging it's as easy as including a dependency package "pigz" to the RPM or better yet just leaving it out as optional and documenting how to enable it.

@thaJeztah
Copy link
Copy Markdown
Member

Discussing in the maintainers meeting; we're ok with using an external binary, and use pigz by default for decompression.

w.r.t. the environment variable; we think we should use this by default (ie., use pigz if the binary was found), but have an environment variable to disable the parallel decompression.

@jboero can you update the PR with those changes?

@AkihiroSuda
Copy link
Copy Markdown
Member

ref: similar PR: #35697

@thaJeztah
Copy link
Copy Markdown
Member

For decompression, this has now been implemented through #35697, so closing this one. Thanks!

@thaJeztah thaJeztah closed this Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants