The codec-compression plug-in supports the brotli and zstd compression algorithms, delivering higher index compression ratios and significantly reducing storage costs.
Prerequisites
Make sure you have completed the following tasks:
-
Create an Alibaba Cloud Elasticsearch V6.7.0 cluster. For more information, see Create an Alibaba Cloud Elasticsearch cluster.
ImportantThe codec-compression plug-in is available only for Alibaba Cloud Elasticsearch V6.7.0 clusters.
-
Make sure the codec-compression plug-in is installed. This plug-in is installed by default on new clusters.
Check the plug-in status on the Plug-ins page. If the plug-in is not installed, install it manually. For more information, see Install or uninstall a built-in plug-in.
Background information
The plug-in supports the brotli and zstd compression algorithms and is designed for write-heavy workloads with high storage costs, such as logging and time-series analytics.
-
Test environment
-
Configuration: Three data nodes, each with 16 cores, 64 GB of memory, and a 2 TB SSD cloud disk.
-
Dataset: The 74 GB nyc_taxis dataset from the official esrally.
-
Index settings: Default settings were used. A force merge operation was performed after the data was written.
-
-
Test results
Compression algorithm
Index size (GB)
Write TPS (doc/s)
Elasticsearch default compression algorithm (LZ4)
35.5
202682
best_compression (DEFLATE)
26.4
181686
brotli
24.4
182593
zstd
24.6
181393
-
Conclusion
Compared to the default compression algorithm (LZ4), brotli and zstd reduce write performance by 10% but improve the compression ratio by 45%, with no impact on query performance. Compared to the native best_compression (DEFLATE) setting, they improve the compression ratio by 8% without affecting write or query performance.
Procedure
-
Log on to the Kibana console.
For more information, see Log on to the Kibana console.
-
In the left-side navigation pane, click Dev Tools.
-
In the Console, run the following commands to set a compression algorithm for an index.
NoteIn Alibaba Cloud Elasticsearch V6.7.0, the codec setting is static and can be set only when an index is created. You cannot modify the codec of an existing index. To change the compression algorithm for an existing index, you must reindex its data:
-
Create a new index and specify the target compression algorithm in the index settings, such as
"codec": "brotli". -
Use reindex to migrate data from the old index to the new index.
-
After verifying that the data is correct, delete the old index.
-
brotli compression algorithm
PUT index-1 { "settings": { "index": { "codec": "brotli" } } } -
zstd compression algorithm
PUT index-1 { "settings": { "index": { "codec": "zstd" } } }
-