GithubHelp home page GithubHelp logo

twcs's Introduction

TWCS: Time Window Compaction Strategy

Motivation

TWCS is a proposed improvement on DTCS. The motivations for TWCS are explained at:

https://issues.apache.org/jira/browse/CASSANDRA-9666

And:

http://www.slideshare.net/JeffJirsa1/cassandra-summit-2015-real-world-dtcs-for-operators

Setup

Checkout the repo:

git clone https://github.com/jeffjirsa/twcs/

Switch to the right version (for newest 2.1 release, for example):

git checkout origin cassandra-2.1 

Build the jar:

mvn compile
mvn package

The resulting jar will be placed in target/, copy it to the classpath of your cassandra server.

Enabling

Use the WITH compaction= directive to set the compaction strategy. By default, TWCS creates 1 Day buckets and assumes MICROSECOND resolution.

Use compaction_window_unit of MINUTES, HOURS, or DAYS and compaction_window_size as an integer to group sstables into buckets of a fixed size that matches your use case.
Use timestamp_resolution to let the compaction strategy know which time unit to use.

To create 3 minute buckets of microsecond resolution (for example, for data with very short TTL), you would use:

CREATE TABLE twcs (
id int,
value int,
PRIMARY KEY ((id))
) WITH compaction= {
    'compaction_window_unit': 'MINUTES',
    'compaction_window_size': '3',
    'class':'com.jeffjirsa.cassandra.db.compaction.TimeWindowCompactionStrategy'
    };

You should target fewer than 50 buckets per table based on your TTL. A TTL of 90 days may want 3 day buckets, where a TTL of 2 hours may want 5 minute buckets.

Source

This repository ( https://github.com/jeffjirsa/twcs ) will be used for standalone TWCS code (simple jar to drop into lib/). For practical purposes, in this repository the compaction strategy is com.jeffjirsa.cassandra.db.compaction.TimeWindowCompactionStrategy

TWCS is also available as a C* fork (in the hopes that patches are accepted upstream):

2.1: https://github.com/jeffjirsa/cassandra/tree/twcs-2.1

2.2: https://github.com/jeffjirsa/cassandra/tree/twcs-2.2

Trunk / 3.0: https://github.com/jeffjirsa/cassandra/tree/twcs

In the full fork, the compaction strategy is: org.apache.cassandra.db.compaction.TimeWindowCompactionStrategy

License

TWCS is provided under the Apache License, V2: http://www.apache.org/licenses/LICENSE-2.0

twcs's People

Contributors

jeffjirsa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.