Warum gibt rsync über SSH mir 10x den Durchsatz von SCP?
scp user@aws-ec2:~/file file
rsync --partial --progress -Pav -e ssh user@aws-ec2:~/file file
scp
gibt mir nur 200K / s, aber rsync
gibt mir 1.9 M / s
Ich habe mehrmals getestet, alle gleichen Ergebnisse.
rsync
verwendet mehrere Threads??
2 answers
Beide Protokolle basieren auf SSH. Und SSH selbst hat einen gewissen Overhead:
SCP ist ein wirklich naives Protokoll mit einem wirklich naiven Algorithmus zum Übertragen einiger kleiner Dateien. Es hat eine Menge von Synchronisation (RTT - Round Trip Time) und kleine Puffer (im Grunde 2048 B -- Quelle).
Rsync ist auf Leistung ausgelegt und liefert daher viel bessere Ergebnisse und mehr Funktionen.
Die 10x Beschleunigung ist spezifisch für Ihren Fall. Wenn Sie würden übertragen Sie Dateien auf der ganzen Welt über Lanes mit hoher Latenz, Sie würden im Fall scp
eine viel schlechtere Leistung erzielen, aber im lokalen Netzwerk kann die Leistung fast gleich sein.
Und nein, Komprimierung (-C
für scp
) hilft nicht. Die größten Probleme sind die Latenz und die Puffergröße.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2016-07-15 11:22:13
RSYNC vs SCP -
SCP führt im Grunde genommen eine einfache alte Kopie von der Quelle zum Ziel lokal oder über ein Netzwerk hinweg mit SSH durch,aber Sie können möglicherweise den Schalter -C
verwenden, um die SSH-Komprimierung zu aktivieren, um die Kopie von Daten möglicherweise zu beschleunigen über das Netzwerk.
RSYNC überträgt nur die Unterschiede zwischen zwei Datensätzen über die Netzwerkverbindung, wobei ein effizienter Prüfsummensuchalgorithmus verwendet wird, der die Netzwerkverbindung während einer Datenübertragung.
RSYNC -
BESCHREIBUNG
rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated. The rsync remote-update protocol allows rsync to transfer just the dif- ferences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.
SCP -
BESCHREIBUNG
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same secu‐ rity as ssh(1). scp will ask for passwords or passphrases if they are needed for authentication. File names may contain a user and host specification to indicate that the file is to be copied to/from that host. Local file names can be made explicit using absolute or relative pathnames to avoid scp treat‐ ing file names containing ‘:’ as host specifiers. Copies between two remote hosts are also permitted.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2016-07-15 20:14:34