Rsync有用于压缩的命令行参数:
-z, --compress compress file data during the transfer
--compress-level=NUM explicitly set compression level
--compress-level
是什么意思?哪些数字可以用作级别?
发布于 2016-11-18 08:49:31
在0到9之间的值。其中1
是最快的,而9
是最压缩的。除此之外,rsync和zlib之间还有关联,其中rsync告诉zlib库“使用默认压缩”。在zlib的文档中,它说:
Z_DEFAULT_COMPRESSION
请求速度和压缩之间的默认折衷(目前相当于6级)。
发布于 2022-01-13 14:03:05
由于版本3.2.0支持的不仅仅是zlib,所以rsync:
--compress, -z
turn on compression
--compress-choice=STR, --zc=STR
choose compression from lz4 (fastest), zstd, zlibx, zlib (slowest), none
--compress-level=NUM, --lz=NUM
zlib and zstd can be tuned with compression level
zlib from 1 (lowest) to 9 (highest), default 6
zstd from -131072 to 22, default 3
发布于 2019-06-18 12:45:31
所使用的环境由两个与MACVLAN一起使用的码头容器+一些噪声流量(误差约为±1% )组成,在我的例子中,fileX是二进制的。
因此,下面是rsync tarred文件与压缩rsync (选项-z)的结果。
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)
https://serverfault.com/questions/815688
复制相似问题