O rsync pode atualizar um arquivo grande que foi alterado apenas parcialmente sem retransmissão completa?

6

Estou fazendo uma pequena alteração em um arquivo de imagem de arquivo muito grande (com apenas alguns pixels de diferença), o que leva muito tempo para ser transferido pela rede.

Existe uma maneira do rsync identificar a diferença no arquivo e enviar apenas o pequeno diff pela rede?

    
por David Parks 22.05.2017 / 18:20

1 resposta

4
O algoritmo de transferência delta

rsync faz isso por padrão. Citando página de manual do rsync :

DESCRIPTION

Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.

Se você quiser desativá-lo, precisará usar a opção -W ou --whole-file .

-W, --whole-file

This option disables rsync's delta-transfer algorithm, which causes all transferred files to be sent whole. The transfer may be faster if this option is used when the bandwidth between the source and destination machines is higher than the bandwidth to disk (especially when the "disk" is actually a networked filesystem). This is the default when both the source and destination are specified as local paths, but only if no batch-writing option is in effect.

Se você realmente sabe o quanto seu arquivo mudou, você pode até mesmo otimizar esse comportamento de delta transferindo seu tamanho de bloco delta:

-B, --block-size=BLOCKSIZE

This forces the block size used in rsync's delta-transfer algorithm to a fixed value. It is normally selected based on the size of each file being updated. See the technical report for details.

E se você quiser mais informações sobre o algoritmo em si, pode encontrá-lo aqui: O algoritmo Rsync

    
por 22.05.2017 / 20:49

Tags