Skip to content

MatejTymes/cassandra-zstd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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'}

About

Zstandard compressor for Cassandra 3.x

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages