Running multiple scp threads simultaneously
Solution 1:
I would do it like this:
tar -cf - /manyfiles | ssh dest.server 'tar -xf - -C /manyfiles'
Depending on the files you are transferring it can make sense to enable compression in the tar
commands:
tar -czf - /manyfiles | ssh dest.server 'tar -xzf - -C /manyfiles'
It may also make sense that you choose a CPU friendlier cipher for the ssh
command (like arcfour):
tar -cf - /manyfiles | ssh -c arcfour dest.server 'tar -xf - -C /manyfiles'
Or combine both of them, but it really depends on what your bottleneck is.
Obviously rsync
will be a lot faster if you are doing incremental syncs.
Solution 2:
Use rsync
instead of scp
. You can use rsync
over ssh
as easily as scp
, and it supports "pipelining of file transfers to minimize latency costs".
One tip: If the data is compressible, enable compression. If it's not, disable it.