I have a ton of relativity small data files but they take up about 50 GB and I need them transferred to a different machine. I was trying to think of the most efficient way to do this.

Thoughts I had were to gzip the whole thing then rsync it and decompress it, rely on rsync -z for compression, gzip then use rsync -z. I am not sure which would be most efficient since I am not sure how exactly rsync -z is implemented. Any ideas on which option would be the fastest?

link|improve this question
feedback

3 Answers

You can't "gzip the whole thing" as gzip only compress one file, you could create a tar file and gzip it to "gzip the whole thing" but you would loose rsync capability of copying only modified file.

So the question is: is it better to store file I need to rsync gziped or rely on -z option of rsync.
The answer is probably that you don't want the file unzipped on your server ? I guess yes, so I don't see how you could manage to gzip file before doing the rsync.

May be you don't need the rsync capability of copying only modified file ? In this case why using rsync instead of doing a scp of a tar.gz file containing your stuff ?

Anyway to answer the question, rsync gzip will be a little less efficient than gziping file with gzip. Why ? because rsync will gzip data chunk by chunk, so a smaller set of data will be used to create the table that gzip use to do compression, a bigger set of data (gzip would use the whole file at once) give a better compression table. But the difference will be very very small in most case but in very rare case the difference can be more important (if you have a very large file with very long partern repeating many time on the file but far away from each other) (This is a very simplified example)

link|improve this answer
1  
From how I read his question, he'll compress to get it over the wire and then decompress the other side. I'd go with rsync native compression over gzip, simply because compressing and decompressing 50GB can take a significant amount of time. Then again, if the files are mostly text, they'll compress nicely. Third option: copy the files to a USB drive. – Randolph West Jun 24 '10 at 0:08
1  
@Randolph Potter: yes time lost to compress 50GB locally then rsync would be higher than using rsync -z, anyway if he want to take advantage of rsync itself (copying only changed file) compression can't be done before – radius Jun 24 '10 at 0:15
very good point. +1 for you :-) – Randolph West Jun 24 '10 at 0:27
feedback

If you're only copying the data once, rsync isn't going to be a big win in and of itself. If you like gzip, (or tar+gzip, since you have many files), you might try something like:

tar -cz /home/me/source/directory | ssh target -xz --directory /home/you/target/directory

That would get the compression you are looking for and just copy directly without involving rsync.

link|improve this answer
feedback

According to this guy it may just be faster to use rsync -z, although I would guess it would be close to as efficient as compressing each file first before transferring. It should be faster than compressing the tar stream, as suggested by others.

From the man page:

          Note  that  this  option  typically  achieves better compression
          ratios than can be achieved by using a compressing remote  shell
          or  a  compressing  transport  because it takes advantage of the
          implicit information in the matching data blocks  that  are  not
          explicitly sent over the connection.
link|improve this answer
I would suggest using --compress-level=1 with rsync -z if you have a fast network. You want the network to be your bottleneck, not CPU or disk IO, to minimize total transfer time. If the network is slow, using the default -z (which is equivalent to gzip -6 I think) might still make the process network bound. – rmalayter Jul 9 '10 at 13:36
feedback

Your Answer

 
or
required, but never shown