Configuring compaction
Steps for configuring compaction.
In addition to consolidating SSTables, the compaction process merges keys, combines columns, evicts tombstones, and creates a new index in the merged SSTable.
There are two different compaction strategies that you can configure on a table:
- Size-tiered compaction
- Leveled compaction
In Cassandra 1.2 and later, you can configure when compaction (eviction) occurs for tombstones for TTL-configured and deleted columns with the tombstone parameters. Setting these parameters helps you avoid having to manually performing compaction to recover disk space.
You can set subproperties for the chosen compaction strategy:
Parameter | SizeTieredCompactionStrategy | LeveledCompactionStrategy |
---|---|---|
bucket_high | Yes | No |
bucket_low | Yes | No |
max_threshold | Yes | Yes |
min_threshold | Yes | Yes |
min_sstable_size | Yes | No |
sstable_size_in_mb | No | Yes |
tombstone_compaction_interval | Yes | Yes |
tombstone_threshold | Yes | Yes |
You can specify a number of compaction parameters in the cassandra.yaml file:
- snapshot_before_compaction
- in_memory_compaction_limit_in_mb
- multithreaded_compaction
- compaction_preheat_key_cache
- concurrent_comactors
- compaction_throughput_mb_per_sec
To configure compaction, construct a property map in the CQL collection format:
name = { 'name' : value, 'name', value : 'name', value ... }
In this string, italics indicates optional.