Cassandra Zstandard Compressor

Zstandard compressor for Cassandra 3.x

License

License

Categories

Categories

Cassandra Data Databases
GroupId

GroupId

com.github.matejtymes
ArtifactId

ArtifactId

cassandra-zstd
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Cassandra Zstandard Compressor
Zstandard compressor for Cassandra 3.x
Project URL

Project URL

https://github.com/MatejTymes/cassandra-zstd
Source Code Management

Source Code Management

https://github.com/MatejTymes/cassandra-zstd/tree/master

Download cassandra-zstd

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.matejtymes/cassandra-zstd/ -->
<dependency>
    <groupId>com.github.matejtymes</groupId>
    <artifactId>cassandra-zstd</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.matejtymes/cassandra-zstd/
implementation 'com.github.matejtymes:cassandra-zstd:0.2.0'
// https://jarcasting.com/artifacts/com.github.matejtymes/cassandra-zstd/
implementation ("com.github.matejtymes:cassandra-zstd:0.2.0")
'com.github.matejtymes:cassandra-zstd:jar:0.2.0'
<dependency org="com.github.matejtymes" name="cassandra-zstd" rev="0.2.0">
  <artifact name="cassandra-zstd" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.matejtymes', module='cassandra-zstd', version='0.2.0')
)
libraryDependencies += "com.github.matejtymes" % "cassandra-zstd" % "0.2.0"
[com.github.matejtymes/cassandra-zstd "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.luben : zstd-jni jar 1.1.1
org.apache.cassandra : cassandra-all jar 3.0.0

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3

Project Modules

There are no modules declared in this project.

cassandra-zstd

This will allow you to use Zstandard compression in Cassandra 3.x

Zstandard

Zstandard is a Facebooks efficient opensource compression algorithm that can be located here: zstd

It is implemented in C library, so to make it usable in Java this project is used: zstd-jni

Installation

You can build the project yourself or access it via Gradle:

compile 'com.github.matejtymes:cassandra-zstd:0.2.0'

Maven:

<dependency>
    <groupId>com.github.matejtymes</groupId>
    <artifactId>cassandra-zstd</artifactId>
    <version>0.2.0</version>
</dependency>

or your other preferred dependency manager.

Then you have to copy the final jar and its zstd-jni dependency into the cassandra folder

cp cassandra-zstd-{version}.jar {cassandra_home}/lib
cp zstd-jni-{version}.jar {cassandra_home}/lib

Configuration

To create a new table with Zstandard compression enabled you have to add this setting to it:

CREATE TABLE KEYSPACE_NAME.TABLE_NAME (
  ...
) WITH compression = { 'sstable_compression': 'org.apache.cassandra.io.compress.ZstdCompressor', [options] }

To update the compression algorithm on already existing table please execute this command:

ALTER TABLE KEYSPACE_NAME.TABLE_NAME 
WITH compression = { 'sstable_compression': 'org.apache.cassandra.io.compress.ZstdCompressor', [options] }

Options

There is currently only one option available

  • compression_level - if no value is defined 1 will be used as the default value. (To find more details about the compression levels please consult the Picking a compression level section in here)

You can choose to omit the options and the defaults will be used:

... WITH compression = { 'sstable_compression': 'org.apache.cassandra.io.compress.ZstdCompressor' }

or you can define your own value:

... WITH compression = { 'sstable_compression': 'org.apache.cassandra.io.compress.ZstdCompressor',  'compression_level': '16'}

Versions

Version
0.2.0
0.1.0