question

rajib76 avatar image
rajib76 asked Erick Ramirez answered

Does compaction run automatically in the background?

We did a bulk load and saw that the SSTABLE count went up to 8 for a table. Will it come down over a period of time if compaction runs incrementally in the background.

compaction
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

steve.lacerda avatar image
steve.lacerda answered

Hi! Yes, compaction runs automatically in the background and when it runs and the process by which it runs depends on the compaction strategy for the table.

By the way, there is a way to force auto compactions to be turned off:

alter table <tablename> with compaction = { 'class':'CompactionStrategy', 'enabled':'false};

However, that's not the default so someone would have had to turn that off.

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered

Compactions run as part of the normal operation of Cassandra nodes. Table compactions on a node get triggered when certain thresholds are met. These triggers are dependent on the compaction strategy and compaction sub-properties configured for each table.

The number of SSTables after bulk-loading data isn't something you should be concerned with. New SSTables getting created is normal and there is nothing unusual about it. It happens when memtables are flushed to disk or when older SSTables are compacted into a new SSTable.

If you're interested, this video extract from the DS201 Cassandra Foundations course at the DataStax Academy talks about compactions in more detail. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.