Live data from Hacker News

A parallel implementation of gzip for modern multi-processor multi-core machines

github.com

41–50 of 70 posts

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#41

Why not just use GNU parallel? `parallel gzip ::: file1 file2` I wish there was a standard for this type of stuff. So that an app will check for existing child spawns and act accordingly (IPC).

That doesn't help if you have only one big file or stream.

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#42
I love it! I just wish somebody can make a GPU based compression library (doesn't have to be gzip or bzip), every mobile device today is shipping with a GPU, there are some techniques out there like this (http://on-demand.gputechconf.com/gtc/2014/presentations/S445...), but I am still waiting for a solid implementation.

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#43
post #30
post #25

Earlier quoted context omitted.

With 2 cores (4 logical) 58.9% decrease in time for the 680 MB file a.txt: # time pigz -c /tmp/a.txt > /dev/null real 0m19.352s user 1m16.148s sys 0m0.344s # time gzip -c /tmp/a.txt > /dev/null real 0m47.093s user 0m46.940s sys 0m0.104s

First, thanks for the numbers, it's useful to see real world examples. Second, and this isn't meant to be a critique (I'm just trying to understand phenomena I see), is there a reason you prefer presenting it as a percentage decrease? Every time I read "X% decrease" I feel obliged to read the source numbers because I'm never sure if the person is using the terminology correctly or not (you are), since so often people…

In my experience, it is more typical to use percent change or relative change in the physical sciences and this is how I was taught. Just to be clear, if you have values t1 and t2, the relative change is (t1-t2)/t1. There is a 1 to 1 correspondence with what you described which is t2/t1.

I think teej explained it well. If I say "the new value is +20% or -20%", it is immediately obvious those have the same magnitude and opposite direction. But, for some people, when I say "the new value is 120% or 80% of the old value", it is not immediately obvious that they have the same magnitude. It requires a small extra step for the reader to realize that this means the same amount of relative change.

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#44
post #27
post #5

pigz is extremely fast and very capable, plus it's packed up and provided for almost every mainstream linux distribution, and can act as a drop in replacement for gzip as it supports the same flag syntax. On the bzip2 side there is pbzip2, which is also a drop in replacement, http://compression.ca/pbzip2/

pbzip2 only does parallel compression. lbzip2 can parallelize compression and decompression. With both pbzip2 and lbzip2 I got errors every now and then while everything worked with bzip2. YMMV. Also note that bzip2 is block based (due to bwt) and thus does not compromise compression ratios like parallelized gzip implantations. At 32 cores you can saturate Gbit links (even with good compression ratios!). I hope we wi…

Errors sound deeply concerning. What kind of errors? Is it too risky to use [pl]bzip2 for archival reasons?

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#48
post #2

My guess is that this compresses less efficiently as you would have to shard the dictionaries. Might be close though for large files. I was surprised that there were no speed or efficiency comparisons in the README.

Actually, it does not compress less efficiently, but you do not learn this fact from the README. Instead you have to look inside the man page (https://raw.githubusercontent.com/madler/pigz/master/pigz.1):

The input blocks, while compressed independently, have the last 32K of the previous block loaded as a preset dictionary to preserve the compression effectiveness of deflating in a single thread.

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#49
post #5

pigz is extremely fast and very capable, plus it's packed up and provided for almost every mainstream linux distribution, and can act as a drop in replacement for gzip as it supports the same flag syntax. On the bzip2 side there is pbzip2, which is also a drop in replacement, http://compression.ca/pbzip2/

pbzip2 produces a separate bzip2 stream for every compressed block, which can't be read properly by many popular decoders, usually ones that are based around the bzip2 high-level interface [0]. There's a warning about this in Python 2's documentation, which is a better offering than most [1].

Many decoders simply stop reading after decompressing the first 900k without so much as a peep that something that may astonish you has happened.

  [0] http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#hl-interface  
  [1] https://docs.python.org/2/library/bz2.html#bz2.BZ2File

Re: A parallel implementation of gzip for modern multi-processor multi-core machines

#50

I learned about pigz in the High Performance MySQL O'Reilly book appendix. I used it, and other techniques there to improve our MySQL backup/restore time by 7x. This in turn won first place at a company hackathon.

Have you compared with mydumper / myloader?
Post reply on HN