Recently I was wondering why I do only get 1-2 mbit/s on a gbit/s link while using zfs send. As it turned out xz caused that. xz with default settings is just too slow for this sort of data. Due to that I compared the available compression methods in linux. Well, at least some of them.
My test-case is simple. I’ve created a snapshot called backup and now I do
time zfs send -R storage@backup | xz > test.xz. The dataset on the celeron machine is 1665576 K and the same dataset on the xeon machine is 1765767 K big (and I have no idea about why there’s a difference. However, for my tests that shouldn’t matter)
MB/s is calculated as original-size / time-in-seconds
Comp is calculated as 100 – (compressed-size * 100) / original-size
|#||Intel® Celeron® CPU J1900 @ 1.99GHz||Intel® Xeon® CPU E5-1620 v3 @ 3.50GHz|
|Brotli –window 24 –quality 1||1m9.604s||1104568||23,36||33,69||0m16.917s||1104528||101,93||37,45|
I think this table shows some interesting results, though keep in mind that (a) you are able to tune the compression tools. For example you could use xz -3 to get more speed for lesser compression. I’ve used the default settings. (b) this comparison is just for my specific use case.
You can easily see that brotli and xz are not well suited for this data-stream due to their slowness You can see that the default settings for brotli and xz are not useful for my use-case. As expected the ancient compress-utility just increases the size and is as such not very useful neither. lz4 is the fastest of the tested compression tools offering okay’ish compression (14-19% smaller size). Zstandard looks very promising. It’s speed is similar to pigz (parallel gzip) and lzop just somewhat slower than lz4, offering average compressibility similar to gzip. The default compression level for Zstandard is 1 which means you might get even more compressibility (at the cost of speed) by tuning that.
Not sure if Zstandard should be used in production now, though. If I’d go for standard utilities I’d decide between lz4, lzo and pigz. From these 3, looking for a compromise between speed and compression, pigz would be my choice.
Update checked with brotli –window 24 –quality 1 according to Jyrki’s comment. Thanks. To be fair I should pick good settings for the other compression tools, too. Updating if I have time for that.