On Thu, Feb 25, 2021 at 08:18:53AM -0500, Neal Gompa wrote: > On Wed, Feb 24, 2021 at 11:10 PM Amy Parker <enbyamy@xxxxxxxxx> wrote: > > > > The compression options in Btrfs are great, and help save a ton of > > space on disk. Zstandard works extremely well for this, and is fairly > > fast. However, it can heavily reduce the speed of quick disks, does > > not work well on lower-end systems, and does not scale well across > > multiple cores. Zlib is even slower and worse on compression ratio, > > and LZO suffers on both the compression ratio and speed. > > > > I've been laying out my plans for a backup software recently, and > > stumbled upon LZ4. Tends to hover around LZO compression ratios. > > Performs better than Zstandard and LZO slightly for compression - but > > significantly outpaces them on decompression, which matters > > significantly more for users: > > > > zstd 1.4.5: > > - ratio 2.884 > > - compression 500 MiB/s > > - decompression 1.66 GiB/s > > zlib 1.2.11: > > - ratio 2.743 > > - compression 90 MiB/s > > - decompression 400 MiB/s > > lzo 2.10: > > - ratio 2.106 > > - compression 690 MiB/s > > - decompression 820 MiB/s > > lz4 1.9.2: > > - ratio 2.101 > > - compression 740 MiB/s > > - decompression 4.5 GiB/s > > > > LZ4's speeds are high enough to allow many applications which > > previously declined to use any compression due to speed to increase > > their possible space while keeping fast write and especially read > > access. > > > > What're thoughts like on adding something like LZ4 as a compression > > option in btrfs? Is it feasible given the current implementation of > > compression in btrfs? > > This is definitely possible. I think the only reason lz4 isn't enabled > for Btrfs has been the lack of interest in it. I'd defer to some of > the kernel folks (I'm just a user and integrator myself), but I think > that's definitely worth having lz4 compression supported. LZ4 support has been asked for so many times that it has it's own FAQ entry: https://btrfs.wiki.kernel.org/index.php/FAQ#Will_btrfs_support_LZ4.3F The decompression speed is not the only thing that should be evaluated, the way compression works in btrfs (in 4k blocks) does not allow good compression ratios and overall LZ4 does not do much better than LZO. So this is not worth the additional costs of compatibility. With ZSTD we got the high compression and recently there have been added real-time compression levels that we'll use in btrfs eventually.