This page documents rough and ready speed tests I performed to investigate how best to copy files between two Linux computers across a fast network. The conclusions are that scp and rsync leave a lot to be desired, that sshfs is the slowest of the bunch by a factor of 6 for lots of small files, and that 3 times faster transfers than with scp can be obtained using tar over ssh while still retaining a secure connection.
Tests were performed transferring data between two computers running Ubuntu 10.04.4 LTS (Lucid Lynx). The two computers contained dual core Intel Pentium D 3.2 GHz processors and 4 GB of memory, and were connected using Intel pro/1000 ethernet adapters over a gigabit ethernet connection through an old but high performance Cisco switch. The hard drive on each machine had a write speed of approximately 50 MB/s; this is rather slow, and so efficient nonblocking and buffering will be an important feature of these speed tests.
Two data sets were tested. An incompressible data set consisted of 200 files each of 10 MB of random data from /dev/urandom. A compressible data set consisted of the uncompressed GCC 4.6.3 source tree (610 MB).
All measurements are given as average ± standard deviation, where standard deviation is not provided if it is zero to the stated precision. These measurements are taken from a number (usually 5) of independent transfers.
Several methods of transfer were considered. These are listed below for transferring from src to dest on computer remote:
In all cases, the version of ssh used was OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009, and the version of (GNU) tar used was 1.22. All tests were run using the default options unless specified. For the version of ssh used, the default cipher is aes128-ctr and the default MAC is hmac-md5.
The first tests aimed to find the fastest ssh ciphers and compare them with the other methods. All tests in here are on incompressible data.
| program | cipher | ||||||
|---|---|---|---|---|---|---|---|
| default | aes128-ctr | aes128-cbc | blowfish-cbc | cast128-cbc | arcfour128 | arcfour | |
| scp | 33.7±0.7 MB/s | 33.6±0.1 MB/s | 33.7±0.1 MB/s | 33.8±0.1 MB/s | 31.1±0.1 MB/s | 34.4±0.7 MB/s | 33.8±0.1 MB/s |
| tar over ssh | 53.3 MB/s | 53.4 MB/s | 64.9 MB/s | 52.9 MB/s | 33.9 MB/s | 85.3±0.1 MB/s | 85.8±0.3 MB/s |
| rsync | 32.4±0.2 MB/s | 33.5±0.5 MB/s | 33.7±0.6 MB/s | 33.7±0.7 MB/s | 33.3±0.3 MB/s | 34.5±0.3 MB/s | 33.8±0.5 MB/s |
| tar over netcat | 58.5±2.0 MB/s | ||||||
I conclude that:
The second tests aimed to find the fastest ssh Message Authentication Codes (MACs) and compare them with the other methods. All tests here are on incompressible data using the arcfour cipher found above to be the fastest in this case.
| program | MAC | |||||
|---|---|---|---|---|---|---|
| hmac-md5 | hmac-md5-96 | hmac-sha1 | hmac-sha1-96 | hmac-ripemd160 | umac-64@openssh.com | |
| scp | 34.0±0.1 MB/s | 33.9±0.4 MB/s | 34.0±0.4 MB/s | 34.0±0.1 MB/s | 33.9±0.3 MB/s | 34.0±0.1 MB/s |
| tar over ssh | 85.7±0.2 MB/s | 83.9±0.3 MB/s | 73.2±0.2 MB/s | 73.8±0.1 MB/s | 62.1±0.1 MB/s | 96.7±0.2 MB/s |
| rsync | 33.6±0.7 MB/s | 34.0±1.3 MB/s | 34.1±0.4 MB/s | 33.4±0.7 MB/s | 33.8±0.6 MB/s | 34.0±0.8 MB/s |
I conclude that:
The third tests aimed to find the best way to deal with compressibility. In addition to ssh's -C flag which enables compression within ssh, rsync offer the -z flag and tar offers both the -z and -j flags. The -j flag uses bzip2 for compression, while all the others use gzip.
All tests were performed using the arcfour cipher and umac-64@openssh.com MAC.
| program | data | compression | |||
|---|---|---|---|---|---|
| none | -C | -z | -j | ||
| scp | compressible | 9.5±0.3 MB/s | 6.5±0.1 MB/s | ||
| tar over ssh | compressible | 100.5±0.9 MB/s | 16.7±0.1 MB/s | 17.3±0.2 MB/s | 5.0 MB/s |
| rsync | compressible | 12.5±0.2 MB/s | 11.7±0.2 MB/s | 11.4±0.1 MB/s | |
| sshfs | compressible | 4.4 MB/s | 3.3 MB/s | ||
| scp | incompressible | 34.7±0.3 MB/s | 13.8 MB/s | ||
| tar over ssh | incompressible | 102.7±1.8 MB/s | 13.7±0.1 MB/s | 13.3±0.2 MB/s | 2.5 MB/s |
| rsync | incompressible | 34.5±0.5 MB/s | 33.7±0.5 MB/s | 33.7±0.5 MB/s | |
| sshfs | incompressible | 33.2±0.5 MB/s | 10.9 MB/s | ||
I conclude that: