I created a file of some size (336M) which I will copied between local and remote file systems using a push strategy and a pull strategy. Lacking having root capability needed to mount filesystems via NFS between say San Jose and Irvine or playing around with SMB I decided to use my home directory, which is NFS mounted, and the local file system of /tmp. By push I mean that cp copying the file from /tmp to my home directory which is NFS mounted thus over the network. By pull I mean that cp was copying the file from my NFS mounted home directory and writing it to /tmp. Therefore push = local reads with network writes and pull = network reads and local writes. Here are the results...
First I did a little loop:
Xl-irv-05:i=0; while [ $i -lt 100 ]; doThis pulls this 336megfile 100 times from my home directory to the local /tmp directory. The GNU time command is used to capture the time each of these takes. Network conditions and system workloads can cause this to vary so I take 100 samples.
/usr/bin/time -f %E -a -o pull.csv cp ~/336megfile /tmp/336megfile
let i=i+1
done
Similarly this loop does the push:
Xl-irv-05:i=0; while [ $i -lt 100 ]; doDoing a little Excel yields:
/usr/bin/time -f %E -a -o push.csv cp /tmp/336megfile ~/336megfile
let i=i+1
done
Bottom line:
Pulling data where the writes are local took on average 0.79 seconds and is 5.45 times quicker than pushing data where the writes are over the network which took, on average, 4.29 seconds.
Pull Push Diff Average 0.79 4.29 5.45
Moral: If you have to work over a LAN or WAN, try to make your writes local...