ZstandardZstandard 是一种快速压缩算法,可提供高压缩率。它还为小数据提供了一种特殊模式,称为 字典压缩。参考库提供了非常广泛的速度/压缩权衡,并由一个极其快速的解码器支持(参见下面的基准测试)。 Zstandard 库以 BSD 许可作为开源软件提供。 它的格式是稳定的,并以 IETF RFC 8878 发布。
|
Several algorithms can produce higher compression ratio but at slower speed, falling outside of the graph. For a larger picture including very slow modes, [click on this link](https://raw.githubusercontent.com/facebook/zstd/master/doc/images/DCspeed5.png) . ### The case for Small Data compression Previous charts provide results applicable to typical file and stream scenarios (several MB). Small data comes with different perspectives. The smaller the amount of data to compress, the more difficult it is to compress. This problem is common to all compression algorithms, and reason is, compression algorithms learn from past data how to compress future data. But at the beginning of a new data set, there is no "past" to build upon. To solve this situation, Zstd offers a __training mode__, which can be used to tune the algorithm for a selected type of data. Training Zstandard is achieved by provide it with a few samples (one file per sample). The result of this training is stored in a file called "dictionary", which must be loaded before compression and decompression. Using this dictionary, the compression ratio achievable on small data improves dramatically. The following example uses the `github-users` [sample set](https://github.com/facebook/zstd/releases/tag/v1.1.3), created from [github public API](https://developer.github.com/v3/users/#get-all-users). It consists of roughly 10K records weighting about 1KB each. Compression Ratio | Compression Speed | Decompression Speed ------------------|-------------------|--------------------  |  |  These compression gains are achieved while simultaneously providing _faster_ compression and decompression speeds. Training works if there is some correlation in a family of small data samples. The more data-specific a dictionary is, the more efficient it is (there is no _universal dictionary_). Hence, deploying one dictionary per type of data will provide the greatest benefits. Dictionary gains are mostly effective in the first few KB. Then, the compression algorithm will gradually use previously decoded content to better compress the rest of the file. ### A rich API set : Zstandard API is designed with learning curve in mind. At the top, you'll find simple methods, using trivial arguments and behavior. Then, at each new paragraph, the API introduces new concepts and parameters, giving gradually more control for advanced usages. You can learn more about Zstandard API by reading [its documentation](https://raw.githack.com/facebook/zstd/release/doc/zstd_manual.html).
[Linux](https://www.phoronix.com/scan.php?page=article&item=linux-414-features)
[FreeBSD](https://svnweb.freebsd.org/changeset/base/329240)
[Redshift](https://aws.amazon.com/about-aws/whats-new/2017/01/amazon-redshift-now-supports-the-zstandard-high-data-compression-encoding-and-two-new-aggregate-functions/)
[Github Actions](https://github.com/actions/cache/pull/270)
[Mercurial](https://www.mercurial-scm.org/wiki/Release4.1)
[RocksDB](https://twitter.com/rocksdb/status/771387757306388480)
[Hadoop](https://issues.apache.org/jira/browse/HADOOP-13578)
[MySQL](https://dev.mysqlserver.cn/doc/relnotes/mysql/8.0/en/news-8-0-18.html#mysqld-8-0-18-connection-control)
[Cassandra](https://issues.apache.org/jira/browse/CASSANDRA-14482)
[MongoDB](http://mongodb.github.io/mongo-java-driver/3.12/driver-async/tutorials/compression/)
[WiredTiger](https://github.com/wiredtiger/wiredtiger/tree/master/ext/compressors/zstd)
[Redis](https://github.com/chadnickbok/redis-zstd-module)
[Presto](https://prestosql.io/docs/current/release/release-314.html)
[ClickHouse](https://clickhouse.ac.cn/docs/en/operations/server-configuration-parameters/settings/#server-settings-compression)
[Groonga](http://groonga.org/en/blog/2016/11/29/groonga-6.1.1.html)
[Tarantool](https://github.com/tarantool/tarantool/blob/master/cmake/BuildZSTD.cmake)
[TokuDB](https://github.com/XeLabs/tokudb/commit/7ba55b2ee6aaac0980daa0a6b269a5c551da4ba6)
[HBase](https://issues.apache.org/jira/browse/HBASE-16710)
[PostgreSQL](https://github.com/grahamedgecombe/pgzstd)
[VictoriaMetrics](https://medium.com/faun/victoriametrics-achieving-better-compression-for-time-series-data-than-gorilla-317bc1f95932)
[Scylla](https://www.scylladb.com/2019/10/04/compression-in-scylla-part-one/)
[Vertica](https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/SQLReferenceManual/Statements/encoding-type.htm?zoom_highlight=zstandard#Zstandar)
[Impala](https://impala.apache.org/docs/build/html/topics/impala_new_features.html)
[Trino](https://trino.io/docs/current/search.html?q=zstd)
[StarRocks](https://docs.starrocks.org.cn/en-us/latest/sql-reference/sql-statements/data-definition/CREATE%20TABLE#set-data-compression-algorithm)
[BtrFS](https://btrfs.wiki.kernel.org/index.php/Compression)
[OpenZFS](https://github.com/openzfs/zfs/commit/10b3c7f5e424f54b3ba82dbf1600d866e64ec0a0)
[SquashFS](https://www.phoronix.com/scan.php?page=news_item&px=Linux-4.14-Zstd-Pull)
[ReFS](https://gist.github.com/0xbadfca11/da0598e47dd643d933dc#refs-39)
[F2FS](https://www.phoronix.com/scan.php?page=news_item&px=F2FS-Zstd-Linux-5.7-Pull)
[ReiserFS](https://metztli.it/blog/index.php/building-new-reiser4-software-format?blog=4)
[TrueNAS](https://github.com/freenas/freenas/pull/5517)
[caddy](https://twitter.com/mholt6/status/1137176475784732673)
[HHVM](https://github.com/facebook/hhvm/commit/d830ac5b335cea8433abcda14a044d71da3bd0dc)
[nginx (module)](https://github.com/tokers/zstd-nginx-module)
[curl](https://github.com/curl/curl/pull/5453)
[wget2](https://twitter.com/ruehsen/status/1050701663995129862)
[django](https://pypi.ac.cn/project/django-compression-middleware/)
[HTTP Toolkit](https://twitter.com/HttpToolkit/status/1396911225108418564)
[winzip](http://kb.winzip.com/kb/entry/313/)
[winrar](https://www.rarlab.com/rarnew.htm)
[PowerAchiver](https://www.powerarchiver.com/2020/04/08/powerarchiver-2021-preview-build-32-is-out-today/)
[Fog](https://news.fogproject.org/fog-1-3-5-rc-9/)
[Backup](https://github.com/borgbackup/borg/issues/1633#issuecomment-307556500)
[libarchive](https://github.com/libarchive/libarchive/pull/905)
[tar](https://www.phoronix.com/scan.php?page=news_item&px=Tar-Zstd-Compression)
[FST](https://github.com/fstpackage/fst/tree/master/src/ZSTD)
[Blosc](https://www.blosc.org/posts/zstd-has-just-landed-in-blosc/)
[bcolz](https://github.com/Blosc/bcolz/tree/master/c-blosc/internal-complibs/zstd-1.1.2)
[Apache Arrow](https://arrow.apache.ac.cn/blog/2020/04/21/0.17.0-release/)
[mrcz](https://github.com/em-MRCZ/c-mrcz)
[bgen](http://www.well.ox.ac.uk/~gav/bgen_format/bgen_format.html)
[Gecko](https://bug635044.bugzilla.mozilla.org/show_bug.cgi?id=1316183)
[HDF5](https://github.com/aparamon/HDF5Plugin-Zstandard)
[Sereal](https://github.com/Sereal/Sereal/tree/master/Perl/shared/zstd)
[PLink2](https://www.cog-genomics.org/plink/2.0/)
[NAF](http://kirill-kryukov.com/study/naf/)
[fbthrift](https://github.com/facebook/fbthrift/commit/ec42813f0ced737617d4614900ef3a96c1f3d17f)
[Fizz](https://github.com/facebookincubator/fizz/blob/master/fizz/protocol/ZstdCertificateCompressor.h)
[proxygen](https://github.com/facebook/proxygen/blob/master/proxygen/lib/utils/ZstdStreamDecompressor.h)
[mcrouter](https://github.com/facebook/mcrouter/blob/master/mcrouter/lib/ZstdCompressionCodec.h)
[Rspamd](https://rspamd.com/announce/2016/11/21/rspamd-1.4.0.html)
[Tor](https://blog.torproject.org/blog/tor-0312-alpha-out-notes-about-0311-alpha)
[NeoMutt](https://neomutt.org/feature/hccompress)
[Rsync](https://download.samba.org/pub/rsync/NEWS#3.2.0)
Intel QAT
[Xilinx](https://github.com/Xilinx/Vitis_Libraries/tree/master/data_compression/L2/tests/zstd_quadcore_compress)
[IBM TS7700](https://developer.ibm.com/storage/2018/11/26/ts7700-enhanced-compression/)
[ZeroPoint](https://www.zeropoint-tech.com/products/nvme-expansion-flash-mx/)
[League of Legends](https://technology.riotgames.com/news/supercharging-data-delivery-new-league-patcher)
[Blender](https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Core)
[Godot](https://github.com/godotengine/godot/tree/master/thirdparty/zstd)
[Khronos's KTX](http://github.khronos.org/KTX-Specification/)
[OpenSiv3D](https://github.com/Siv3D/OpenSiv3D/tree/master/Siv3D/Source/ThirdParty/zstd)
[Esenthel](http://www.esenthel.com/?id=feature_list)
[Mass Effect:Andromeda](https://youtu.be/u3zSdu2mp9A?t=6m33s)
[Ubuntu](https://www.omgubuntu.co.uk/2018/03/faster-ubuntu-installs-zstd-compression)
[Fedora](https://fedoraproject.org/wiki/Changes/Switch_RPMs_to_zstd_compression)
[ArchLinux](https://archlinux.org.cn/news/now-using-zstandard-instead-of-xz-for-package-compression/)
[RPM](https://rpm.org/wiki/Releases/4.14.0)
[PKG](https://svnweb.freebsd.org/ports?view=revision&revision=512256)
[Conda](https://anaconda.net.cn/how-we-made-conda-faster-4-7/)
[GCC](https://www.phoronix.com/scan.php?page=news_item&px=GCC-10-Gets-Zstd-LTO-Byte-Comp)
[Hex-rays IDA](https://docs.hex-rays.com/release-notes/9_1)
[folly](https://github.com/facebook/folly/blob/master/folly/compression/Compression.h#L83)
[cmake](https://cmake.com.cn/cmake/help/v3.15/release/3.15.html)
[TaskCluster](https://github.com/taskcluster/taskcluster-worker/pull/114)
[U++](http://www.ultimatepp.org/www$uppweb$Roadmap$en-us.html)
[Ceph](https://github.com/ceph/ceph/tree/master/src/compressor/zstd)
[LiveScan3D](https://github.com/MarekKowalski/LiveScan3D/pull/14)
[Kiwix](https://www.kiwix.org/en/zim-tools-3-0-0-is-out/)