Database Reference
In-Depth Information
What, Where, Why, and How
Cassandra performs multiple types of compactions. Each has its own frequency
and its own purpose. The two that we will address are major compactions and
minor compactions.
A minor compaction is an automatically triggered compaction that is fired off
whenever a new SSTable is created. It attempts to remove tombstones when ne-
cessary.
A major compaction is a manually triggered compaction through nodetool .
It merges/updates the existing SSTables and removes tombstones when necessary.
Both types of compaction mark unneeded SSTables for deletion if required.
Either a nodetool cleanup or garbage collection will remove the SSTables
that are marked for deletion.
Compaction Strategies
There are two kinds of compaction strategies when it comes to ColumnFamilys.
In order to get the best performance out of Cassandra on reads, you need to
choose the correct compaction strategy for your access pattern. As of Cassandra
1.1, the two types of compaction strategies are SizeTieredCompactionStrategy and
LeveledCompactionStrategy.
SizeTieredCompaction
SizeTieredCompactionStrategy is the default strategy in a Cassandra ColumnFam-
ily. If you don't specify a different strategy when creating your ColumnFamily,
SizeTiered-CompactionStrategy will be used. It is best to use this strategy when
you have insert-heavy, read-light workloads. The one thing that is important to
keep in mind when using SizeTieredCompactionStrategy is that you have to mon-
itor disk space closely. In the worst of scenarios (in other words, large Colum-
nFamilys that put you near half the size of your disk), the ColumnFamily can tem-
porarily double in size while compactions are in progress. More is discussed about
this in the section on monitoring.
Search WWH ::




Custom Search