18
0
I'm looking for the fastest gzip
(or zip) utility. I have a LVM volume which 95% exists out of blank 0
's, so compressing that is very easy. I'm looking for the most fastest solution, and don't really care of the compression except the 0
's.
I'm aware of gzip -1
(same as gzip --fast
) but was wondering if there's any faster method.
Thanks.
Edit:
after some tests, I compared gzip -1
, lzop -1
and pigz -1
with eachother and came to the following results:
PIGZ:
time dd if=/dev/VPS/snap | pigz -1 | ssh backup-server "dd of=/home/backupvps/snap.pigz"
104857600+0 records in
104857600+0 records out
53687091200 bytes (54 GB) copied, 2086.87 seconds, 25.7 MB/s
7093985+266013 records in
7163950+1 records out
3667942715 bytes (3.7 GB) copied, 2085.75 seconds, 1.8 MB/s
real 34m47.147s
LZOP:
time dd if=/dev/VPS/snap | lzop -1 | ssh backup-server "dd of=/home/backupvps/snap.lzop"
104857600+0 records in
104857600+0 records out
53687091200 bytes (54 GB) copied, 1829.31 seconds, 29.3 MB/s
7914243+311979 records in
7937728+1 records out
4064117245 bytes (4.1 GB) copied, 1828.08 seconds, 2.2 MB/s
real 30m29.430s
GZIP:
time dd if=/dev/VPS/snap | gzip -1 | ssh backup-server "dd of=/home/backupvps/snap_gzip.img.gz
104857600+0 records in
104857600+0 records out
53687091200 bytes (54 GB) copied, 1843.61 seconds, 29.1 MB/s
7176193+42 records in
7176214+1 records out
3674221747 bytes (3.7 GB) copied, 1842.09 seconds, 2.0 MB/s
real 30m43.846s
Edit 2:
This is somewhat unrelated to my initial question, however using time dd if=/dev/VPS/snap | lzop -1 | ssh backup-server "dd of=/home/backupvps/snap.lzop"
(block size changed to 16M) the time is reduced to real 18m22.442s
!
1Be careful: it's somewhat unfair to use
time
in such a manner. The throughput of the dd used forpigz
is lower than the other two. – Henk – 2012-03-14T16:15:43.247@Devator: by looking at the timings one might conclude that right now pushing bytes through the encrypted ssh tunnel is the bottleneck. did you try to use ssh with the "-c" (compression) flag and let the pre-compressor out of the equation? you could also switch to a faster encryption algorithm. aside from that: re-benchmark without the ssh-tunnel (eg, using /dev/null as the output sink) – akira – 2012-03-14T17:40:23.197
As a sidenote, could you use a sparse file? Then the zeroes would take up no space on disk. Your compression would also be faster because the zeroes would be interpolated by the filesystem driver (and wouldn't have to be read from disk.)
– Li-aung Yip – 2012-03-15T10:57:56.100@Li-aungYip I don't think so, as the "files" are LVM volumes. – Devator – 2012-03-15T11:03:22.047
Ah, I see. Carry on! – Li-aung Yip – 2012-03-15T11:07:28.867
Also relevant: gzip cannot max out your hard drive in many situations because of unchangeable buffer sizes chosen for the last millenium.
– nh2 – 2013-09-27T19:09:49.160lzop
can.