Twcs

TWCS part 1 - how does it work and when should you use it ?

In this post we’ll explore a new compaction strategy available in Apache Cassandra. We’ll dig into it’s use cases, limitations, and share our experiences of using it with various production clusters.

Time Window Compaction Strategy : how does it work and when should you use it ?

Cassandra uses a Log Structured Merge Tree engine, which allows high write throughput by flushing immutable chunks of data, in the form of SSTables, to disk and deferring consistency on the read phase. Over time, more and more SSTables are written to disk, resulting in a partition having chunks in multiple SSTables, slowing down reads. To limit fragmentation of data, we use a process called compaction to merge sstables together. Several compaction strategies are available in Cassandra that merge SSTables together. These strategies are designed for different workloads and data models.

cassandra compaction twcs
Read more

TWCS Part 2 - Using before Cassandra 3.0

In our first post about TimeWindowCompactionStrategy, Alex Dejanovski discussed use cases and the reasons for its introduction in 3.0.8 as a replacement for DateTieredCompactionStrategy. In our experience switching production environments storing time series data to TWCS, we have seen the performance of many production systems improve dramatically.

The examples Alex gives for making use of TWCS work great for recent versions of Cassandra. However, a significant number of users are still using 2.0, 2.1, and 2.2. If you’re in this group, you can still use TWCS, but it’ll require a little extra work. Let’s take a look at how to achieve this.

cassandra twcs operations
Read more