-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(blooms): Remove compression of
.tar
archived bloom blocks (#14159
) Decompression is a CPU intensive task, especially un-gzipping. The gain of compressing a tar archive of storage optimized binary blocks is neglectable (question: is it?). In this example, the block of ~170MiB is ~3.3MiB bigger when not compressed, which is a ratio of ~2% ```bash $ ls -las 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar 177048 -rw-rw-r-- 1 christian christian 181293056 Sep 18 13:49 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar $ ls -las 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar.gz 173732 -rw-rw-r-- 1 christian christian 177897689 Sep 18 13:49 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar.gz $ qalc '(181293056 - 177897689) / 1024/ 1024' ((181293056 − 177897689) / 1024) / 1024 ≈ 3.238074303 $ qalc '181293056 / 177897689' 181293056 / 177897689 ≈ 1.019086066 ``` After some consideration, we decided to store the encoding of the bloom block in the `BlockRef`. This means, that the changes in this PR do not break compatibility with existing blocks compressed with gzip, although new blocks will not be compressed any more. However, the PR adds support for different compression algorithms, such as gzip, snappy, lz4, flate, and zstd. Compression is not configurable yet. --- Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
- Loading branch information
Showing
18 changed files
with
387 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package compression | ||
|
||
import "fmt" | ||
|
||
const ( | ||
ExtNone = "" | ||
ExtGZIP = ".gz" | ||
ExtSnappy = ".sz" | ||
ExtLZ4 = ".lz4" | ||
ExtFlate = ".zz" | ||
ExtZstd = ".zst" | ||
) | ||
|
||
func ToFileExtension(e Encoding) string { | ||
switch e { | ||
case EncNone: | ||
return ExtNone | ||
case EncGZIP: | ||
return ExtGZIP | ||
case EncLZ4_64k, EncLZ4_256k, EncLZ4_1M, EncLZ4_4M: | ||
return ExtLZ4 | ||
case EncSnappy: | ||
return ExtSnappy | ||
case EncFlate: | ||
return ExtFlate | ||
case EncZstd: | ||
return ExtZstd | ||
default: | ||
panic(fmt.Sprintf("invalid encoding: %d, supported: %s", e, SupportedEncoding())) | ||
} | ||
} | ||
|
||
func FromFileExtension(ext string) Encoding { | ||
switch ext { | ||
case ExtNone: | ||
return EncNone | ||
case ExtGZIP: | ||
return EncGZIP | ||
case ExtLZ4: | ||
return EncLZ4_4M | ||
case ExtSnappy: | ||
return EncSnappy | ||
case ExtFlate: | ||
return EncFlate | ||
case ExtZstd: | ||
return EncZstd | ||
default: | ||
panic(fmt.Sprintf("invalid file extension: %s", ext)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.