@radius, a minor nit to pick about how gzip
works - gzip
is a block-based compression algorithm, and a fairly simple one at that. The whole file is not considered for the compression table - only each block. Other algorithms may use the whole contents of the file and there are a few that use the contents of multiple blocks or even variably-sized blocks. One fascinating example is lrzip
, by the same author as rsync
!
The skinny on gzip
's algorithm.
So, in summary, using rsync -z
will likely yield the same compression as gzip
ing first - and if you're doing a differential transfer, better because of rsync
's diffing algorithm.
That said, I think one will find that regular scp
handily beats rsync
for non-differential transfers - because it will have far less overhead than rsync
's algorithm (which would use scp
under-the-hood anyway!)
If your network does become a bottleneck, then you would want to use compression on the wire.
If your disks are the bottleneck, that's when streaming into a compressed file would be best. (for example, netcat
from one machine to the next, streaming into gzip -c
)
Usually, if speed is key, compressing an existing file before-hand is wasteful.
TIMTOWTDI, YMMV, IANAL, etc.