by mromanuk · 1y ago · 0 comments
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
Probably it's faster to compress to gzip and later transfer. But it's nice to have the possibility to improve the transfer with a a flag.sqlite transaction- and WAL-aware rsync with inflight compression.
When I do stuff like this, I stream the dump straight into gzip. (You can usually figure out a way to stream directly to the destination without an intermediate file at all.)
Plus this way it stays stored compressed at its destination. If your purpose is backup rather than a poor man's replication.
tool cspeed size dspeed
zstd 361 MB/s 16% 1321 MB/s
lzop 512 MB/s 29% 539 MB/s
lz4 555 MB/s 29% 1190 MB/s
If working from files on disk that happen not to be cached, the speed differences are likely to disappear, even on many NVMe disks.(It just so happens that the concatenation of all text-looking .tar files I happen to have on this machine is roughly a gigabyte (though I did the math for the actual size)).
zstd -b1 --fast -i10 some-rpi-os-image-idk.img
-1#-os-image-idk.img :2097152000 -> 226798302 (x9.247), 6765.0 MB/s, 5897.3 MB/s
zstd -b1 --fast -i10 jdk-11.0.8+10.tar
-1#jdk-11.0.8+10.tar : 688844800 -> 142114709 (x4.847), 2660.7 MB/s, 2506.8 MB/s
zstd -b1 --fast -i10 archlinux-2025.04.01-x86_64.iso
-1#.04.01-x86_64.iso :1236303872 ->1221271223 (x1.012), 3643.5 MB/s, 7836.6 MB/sFor every other network, you should compress as you are likely dealing with multiple tenants that would all like a piece of your 40Gbps bandwidth.
(This is the same spiel I give whenever someone says swap on Linux is or is not always beneficial.)