Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using rsync for copying some large files (24MB each):

bronger@steed:/tmp$ time rsync -r root@my_nas::media/distortion .
Password: 

real    0m18.128s
user    0m2.600s
sys     0m5.756s

(Substract 2 seconds for typing the password.) Now, the same thing with NFS:

bronger@steed:/tmp$ time cp -a /mnt/media/distortion .

real    0m5.569s
user    0m0.036s
sys     0m2.128s

How can this be? There is no compression or encryption involved, yet the CPU usage on the server side is 100%. It is a NAS with a slow ARM CPU, but even then any copying action should be limited by IO.

The rsyncd.conf file says:

pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
use chroot = no

[media]
path = /volume1/media 
comment = Main volume                      
fake super = yes                         
uid = 1000
gid = 1000    
read only = no
list = yes     
charset = utf-8  
auth users = root                 
secrets file = /etc/rsyncd.secrets
share|improve this question
    
You're changing both protocol and technique. Could you add a test with a local (directory to directory) rsync for comparison? –  Daniel Beck Dec 29 '12 at 15:16
    
I may change the protocol, but the hardware (disk drives, network interface controllers) is the same, as is the rest of the software stack. If I rsync the local NFS mount (instead of cp), it takes 9 seconds. –  bronger Dec 29 '12 at 15:25
    
I found an LWN article. Maybe rsync is really so CPU-loading while transmitting large chunks of data that it shouldn't run on slow devices. –  bronger Dec 29 '12 at 15:48
add comment

2 Answers

up vote 1 down vote accepted

rsync is slower than NFS if rsync is CPU-bound. rsync is much less efficient than NFS when it comes to the mere transfer of the data. In my case, rsync consumed 100% CPU while NFS needed only 20%, and NFS was still faster by a factor of 3. This means that rsync comsumed 15 times (!) more CPU resources than NFS for the same amount of network traffic. I transfered large files.

The best approach in such a scenario is to mount the directory with NFS on the faster machine, and copy the files with rsync locally.

See an LWN article of someone with a similar problem.

share|improve this answer
add comment

RSync is going to do its homework before beginning to make sure that copying is even a requirement.

If you already had local versions of the files that were the same, rsync would have won because its smarter.

share|improve this answer
    
The directory to be copied didn't exist on the destination machine. It should take milliseconds for rsync to see this. So, the bulk work should be just to send all data through the wire -- in both cases, rsync and NFS. –  bronger Dec 29 '12 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.