Data compression on Disk
Dgraph Alpha lets you configure the compression of data on disk using the --badger
superflag’s compression
option. You can choose between the
Snappy and
Zstandard compression algorithms, or choose
not to compress data on disk.
--badger.compression_level
and
--badger.compression
options used in earlier Dgraph versions.
The following disk compression settings are available:
Setting | Notes |
---|---|
none |
Data on disk will not be compressed. |
zstd:level |
Use Zstandard compression, with a compression level specified (1-3). |
snappy |
Use Snappy compression (this is the default value). |
For example, you could choose to use Zstandard compression with the highest compression level using the following command:
dgraph alpha --badger compression=zstd:3
This compression setting (Zstandard, level 3) is more CPU-intensive than other options, but offers the highest compression ratio. To change back to the default compression setting, use the following command:
dgraph alpha --badger compression=snappy
Using this compression setting (Snappy) provides a good compromise between the need for a high compression ratio and efficient CPU usage.