为什么 SSH 上的 rsync 使我的吞吐量是 SCP 的 10 倍?

Sat*_*ato 13 networking linux ssh rsync scp

  1. scp user@aws-ec2:~/file file
  2. rsync --partial --progress -Pav -e ssh user@aws-ec2:~/file file

scp只给我 200K/s,但rsync给我 1.9M/s

我测试了几次,结果都是一样的。

rsync 使用多线程??

Jak*_*uje 8

这两种协议都基于 SSH。SSH本身有一些开销维基

SCP 是非常幼稚的协议,具有非常幼稚的算法,用于传输一些小文件。它有很多同步(RTT - 往返时间)和小缓冲区(基本上是 2048 B -)。

Rsync 是为性能而设计的,因此它提供了更好的结果并具有更多功能。

10 倍加速特定于您的情况。如果您通过高延迟通道在全球范围内传输文件,在这种scp情况下您的性能会差很多,但在本地网络上,性能几乎相同。

不,压缩(-Cfor scp)无济于事。最大的问题是延迟和缓冲区大小。


Vom*_*yle 7

RSYNC 与 SCP

SCP基本上是在本地或使用 SSH 跨网络执行从源到目标的普通旧副本,但您可以使用该-C开关启用 SSH 压缩,以潜在地加速跨网络的数据复制。

RSYNC仅通过网络连接传输两组文件之间的差异,使用有效的校验和搜索算法在数据传输期间自动优化网络连接。

同步

描述

   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.
Run Code Online (Sandbox Code Playgroud)

来源


SCP

描述

 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.
Run Code Online (Sandbox Code Playgroud)

来源

  • 在这种情况下,情况有点不同:他只复制一个文件。(这可能在远程端还不存在。) (3认同)
  • 在他的 `rsync` 命令行中既没有指定压缩也没有校验和。当然,文件内增量算法始终处于活动状态。可能只是 `scp` 很烂。 (2认同)