Compaction

As noted earlier, a Cassandra instance could have multiple copies of the same data residing on multiple SSTables. If you do a lot of updates to records over time, there is a chance that you will run out of disk space because of redundant data. To prevent this, Cassandra performs compaction, which merges multiple SSTables and gets rid of extra data. One other caveat of performing compaction is that the read will speed up. Consider the scenario where there is no compaction and a record is spread across multiple SSTables on disk. A read will require multiple seeks to fetch the data from all the SSTables and combine them. With compaction, a single row will exist on a single SSTable, and thus, it requires only one disk seek.

Cassandra ...

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.