I'm a bit puzzled by this? Why is rsync faster than scp? Doesn't rsync use scp beneath or does it do something more efficient? Is there some way to speed up scp?
Why is rsync -avz faster than scp -r
rsyncscp
rsyncscp
I'm a bit puzzled by this? Why is rsync faster than scp? Doesn't rsync use scp beneath or does it do something more efficient? Is there some way to speed up scp?
Best Answer
Rsync will obviously be faster than scp if the target already contains some of the source files, since rsync only copies the differences. But I suspect your question was about doing a straightforward copy to an empty target.
You've passed the
-z
option torsync
; this turns on compression. If the network bandwidth is the limiting factor (it often is), compression can improve the transfer speed by a noticeable amount.You can also enable compression with
scp
by passing the-C
option. This should about even things out with rsync. Compression is not enabled by default in ssh because it saves bandwidth but adds latency and CPU overhead; latency is bad for interactive sessions (this doesn't apply toscp
), and the CPU overhead is useless if the files you're copying are already compressed.Older versions of
rsync
used rsh rather than ssh as the default transport layer, so a fair comparison would be betweenrsync
andrcp
. But ssh has been the default since 2.6.0 released on 2004-01-01.With identical compression settings, I'd expect
rsync
andscp
to have essentially the same speed. Please share benchmarks if you find otherwise.