diff --git a/en_US.ISO8859-1/books/handbook/zfs/chapter.xml b/en_US.ISO8859-1/books/handbook/zfs/chapter.xml --- a/en_US.ISO8859-1/books/handbook/zfs/chapter.xml +++ b/en_US.ISO8859-1/books/handbook/zfs/chapter.xml @@ -2926,6 +2926,72 @@ However since quotas do not consider compression, more data may be written than would fit with uncompressed backups. + + + Zstandard Compression + + In OpenZFS 2.0, a new compression + algorithm was added. Zstandard (Zstd) + offers higher compression ratios than the default + LZ4 while offering much greater speeds + than the alternative, gzip. + OpenZFS 2.0 is available starting with + &os; 12.1-RELEASE via + sysutils/openzfs and has been the + default in &os; 13-CURRENT since September 2020, and + will by in &os; 13.0-RELEASE. + + Zstd provides a large selection of + compression levels, providing fine-grained control over + performance versus compression ratio. One of the main + advantages of Zstd is that the + decompression speed is independent of the compression + level. For data that is written once but read many times, + Zstd allows the use of the highest + compression levels without a read performance + penalty. + + Even when data is updated frequently, there are often + performance gains that come from enabling compression. One + of the biggest advantages comes from the compressed ARC + feature. ZFS's Adaptive Replacement + Cache (ARC) caches the compressed version + of the data in RAM, decompressing it each + time it is needed. This allows the same amount of + RAM to store more data and metadata, + increasing the cache hit ratio. + + ZFS offers 19 levels of + Zstd compression, each offering + incrementally more space savings in exchange for slower + compression. The default level is + zstd-3 and offers greater compression + than LZ4 without being significantly + slower. Levels above 10 require significant amounts of + memory to compress each block, so they are discouraged on + systems with less than 16 GB of RAM. + ZFS also implements a selection of the + Zstd fast levels, + which get correspondingly faster but offer lower + compression ratios. ZFS supports + zstd-fast-1 through + zstd-fast-10, + zstd-fast-20 through + zstd-fast-100 in increments of 10, and + finally zstd-fast-500 and + zstd-fast-1000 which provide minimal + compression, but offer very high performance. + + If ZFS is not able to allocate the required memory to + compress a block with Zstd, it will fall + back to storing the block uncompressed. This is unlikely + to happen outside of the highest levels of + Zstd on systems that are memory + constrained. The sysctl + kstat.zfs.misc.zstd.compress_alloc_fail + counts how many times this has occurred since the + ZFS module was loaded. +