Cassandra Cassandra Interview Questions Interview Questions

[Interview Question] – What are the Compaction strategies in Cassandra? difference between each of them?

DSE supports the following compaction strategies, which you can configure using CQL:

  • LeveledCompactionStrategy (LCS): The leveled compaction strategy creates SSTables of a fixed, relatively small size (160 MB by default) that are grouped into levels. Within each level, SSTables are guaranteed to be non-overlapping. Each level (L0, L1, L2 and so on) is 10 times as large as the previous. 
  • SizeTieredCompactionStrategy (STCS): The default compaction strategy. This strategy triggers a minor compaction when there are a number of similar sized SSTables(four by default) on disk as configured by the table subproperty, min_threshold. These are merged together, to form one larger SSTables. Later, when several large SSTables have accumulated, they will be merged to form one even-larger SSTable and so on.

    In this manner, we have several size tiers (small sstables, large sstables, even-larger sstables, etc.)
  • TimeWindowCompactionStrategy (TWCS): This strategy is an alternative for time series data. TWCS compacts SSTables using a series of time windows. While with a time window, TWCS compacts all SSTables flushed from memory into larger SSTables using STCS. At the end of the time window, all of these SSTables are compacted into a single SSTable. Then the next time window starts and the process repeats. The duration of the time window is the only setting required.
  • DateTieredCompactionStrategy (DTCS) (deprecated).

Check more about Configuring compaction

Want to see,
Which compaction strategy is best?

See more information about
SSTable compaction and compaction strategies

Comments Rating 0 (0 reviews)

About the author


Add Comment

Click here to post a comment