Quarkus Snappy
Quarkus Snappy provides Snappy compression and decompression for Quarkus applications.
Snappy is a compression/decompression library that provides very fast compression and decompression with a focus on speed over compression ratio.
Installation
Add the extension to your project:
<dependency>
<groupId>io.quarkiverse.snappy</groupId>
<artifactId>quarkus-snappy</artifactId>
<version>0.1.0</version>
</dependency>
Usage
Once the extension is added, Snappy is automatically available in your application.
import org.xerial.snappy.Snappy;
// Compress
byte[] compressed = Snappy.compress(data);
// Decompress
byte[] decompressed = Snappy.uncompress(compressed);
Native Support
The extension bundles native libraries for Linux, macOS, and Windows, enabling Snappy to work in native images without additional configuration.
Configuration
Snappy’s own knobs are exposed as Quarkus configuration properties. A property left unset keeps Snappy’s own default, so a bare application needs none of them. Unlike setting the underlying org.xerial.snappy.* system properties directly, these are honored in native executables.
# Disable the caching buffer pool used by the framed streams
quarkus.snappy.pool-disable=true
# Extract the bundled native library somewhere executable when /tmp is mounted noexec
quarkus.snappy.temp-dir=/var/tmp
Extension Configuration Reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
Directory to load the native library from instead of extracting the bundled one. Maps to Environment variable: |
string |
|
Name of the native library file to load from Environment variable: |
string |
|
Directory the bundled native library is extracted to before loading. Defaults to the JVM’s Environment variable: |
string |
|
Load a system-installed Environment variable: |
boolean |
|
Disable the caching buffer pool used by the framed streams, selecting the non-caching Environment variable: |
boolean |
|