rsync --compress-level:可以使用哪些压缩级别?


13

Rsync具有用于压缩的命令行参数:

-z, --compress              compress file data during the transfer
    --compress-level=NUM    explicitly set compression level

什么--compress-level意思 哪些数字可以用作等级?

Answers:


16

值介于0到9之间。1最快的地方9压缩最多。除此之外,rsync和zlib之间存在相关性,其中rsync告诉zlib库“使用默认压缩”,在zlib的文档中这样说:

Z_DEFAULT_COMPRESSION请求在速度和压缩之间进行默认折衷(当前等效于6级)。


那么,这些级别的起源是zlib吗?
cronfy

是的,但是如果您可以在rsync 0中设置值,则可以解压缩,然后以该格式发送。
米哈尔

0

所使用的环境由与MACVLAN一起使用的两个docker容器以及一些噪音流量(产生大约±1%的错误)组成。在我的情况下,fileX是一个二进制文件

因此,以下是rsync tarred文件与带有压缩(选项-z)的rsync untarred文件的结果

      1. File tarred + rsync without compression (rsync -axvPAH fileX.tar destination:/path)

    File size is 56933 bits (fileX.tar)
    Transfer difference is 4735665-4673346=62319 bits

      2. File tarred + rsync with default compression (rsync -axvPAH -z fileX destination:/path)

    File size is 56933 (fileX.tar)
    Transfer difference is 4933845-4871608=62237

      3. File tarred + rsync with maximum compression (rsync -axvPAH -z --compress-level=9 fileX.tar destination:/path)

    File size is 56933 bits (fileX.tar)
    Transfer difference is 4870664-4808387=62277

      4. File untarred + rsync with default compression (rsync -axvPAH -z fileX destination:/path)

    File size is 237525 bits (fileX)
    Transfer difference is 4669946-4607637=62309 bits

      5. File untarred + rsync with maximum compression (rsync -axvPAH -z --compress-level=9 fileX destination:/path)

    File size is 237525 bits (fileX)
    Transfer difference is 4806735-4744764=61971 bits

      6. File untarred + rsync without compression (makes no sense since it’s the most bandwidth consuming one) 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.