I've been checking the benchmarks on compression of text. Given that we store each revision separately in external store, the biggest contributor to the growth of ES is wikidata (given the rate of edits on the wiki). Any small improvements could have a decent impact on the storage capacity and lifetime.
I picked 500 pages in a couple of wikis, compressed with different algorithms and then averaged them. The results for normal wikis are a bit all over the place (the ration being higher, the better):
zhwiki: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 2.0011580657564485 gzip : 1.9857647546756871 bz2 (Bzip2) : 1.926178296495638 lzma (XZ) : 2.0368913021126174 ruwiki: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 2.863096812245039 gzip : 2.848671946252398 bz2 (Bzip2) : 3.1432688715395587 lzma (XZ) : 2.974737944477271 enwiki: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 2.427702836086557 gzip : 2.4112390670333816 bz2 (Bzip2) : 2.3381988304527472 lzma (XZ) : 2.392846695043902 arwiki: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 2.705738147892982 gzip : 2.6791698087892235 bz2 (Bzip2) : 2.8576198567047317 lzma (XZ) : 2.6826789430837596
But for Wikidata, no matter how many times I repeat it, lzma always wins:
Try 1: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 5.069681227948362 gzip : 5.072687651518624 bz2 (Bzip2) : 4.609058556764682 lzma (XZ) : 5.318371805033433 Try II: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 5.123151927192675 gzip : 5.122254116011882 bz2 (Bzip2) : 4.6121314372912305 lzma (XZ) : 5.3488774386100895 Try III: Algorithm | Ratio -------------------------------------------------------------- zlib (Deflate) : 4.934902621719569 gzip : 4.932698731722822 bz2 (Bzip2) : 4.4532215294494355 lzma (XZ) : 5.127213408027472
And it has a decent gap with gzip. I wonder if we can make the flag configurable and set it to wikidata to be lzma instead of gzip. There shouldn't be any issues with existing rows, they will just stay there with flag of gzip in the db.