Linux command: pigz multi-threaded compression tool [transfer]

When learning Linux systems, you will learn several compression tools: gzip, bzip2, zip, xz, and related decompression tools. For the use of these tools and the comparison of the compression ratio and compression time between them, see: Learning Archive Compression Tools in Linux

So what is Pigz? Simply put, it is gzip that supports parallel compression. Pigz uses the current number of logical CPUs for concurrent compression by default. If the number cannot be detected, it defaults to 8 concurrent threads. You can also use -p to specify the number of threads. It should be noted that its CPU usage is relatively high.

Official website: http://zlib.net/pigz

Without further ado, let's start testing.

 

original directory size

Compress with gzip (1 thread)

Decompress gzip compressed files

Use pigz compression (4 threads)

Unzip the pigz file

It can be seen that the time of pigz is more than two-thirds faster than that of gzip, but the CPU consumption is several times that of gzip. I am only a virtual machine with 4 threads here. Of course, the CPU usage of pigz is also very impressive. 100%. Therefore, it is very suitable to use pigz in scenarios that require high compression efficiency, but are not affected by high CPU consumption in a short period of time.

Of course, pigz is not faster as the number of threads increases. There is also a bottleneck area. Someone on the Internet has compared it: the concurrent 8 threads are 41.2% higher than 4 threads, the 16 threads are 27.9% higher than 8 threads, and the 32 threads are higher than 16 threads. 3%. It can be seen that the higher the number of threads, the slower the speed increase. More can be tested by yourself.

 

transferred from

Linux command: pigz multi-threaded compression tool - operation and maintenance
http://www.ywnds.com/?p=10332

refer to

tar+pigz+ssh realizes big data compression and
transmission

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326357720&siteId=291194637