Removing tombstones in Cassandra

Deleted files create tombstones in Cassandra. When too many tombstones collect, the speed of transactions decreases. Tombstones are routinely removed to maintain performance.

About this task

To remove tombstones in Cassandra:

Procedure

  1. Monitor the average transaction time to gauge how often to remove tombstones.
  2. Stop each Cassandra node.
  3. Edit the following settings in cassandra.yaml that affect tombstone removal and compaction:
    tombstone_threshold
    Default value is 0.2 (20%)
    tombstone_compaction_interval
    Default: 86400 seconds (1 day)
    Important: If you expect messages to be deleted very rapidly, set smaller values for the tombstone_threshold and tombstone_compaction_interval parameters. All Cassandra settings must be tested in a test environment before deploying in a production environment, to confirm the expected results. Failure to test can have unexpected consequences. For more information about the tombstone purge interval, see Configuring the tombstone purge interval.
  4. Run reaper and compaction processes.
  5. Repeat steps for each node.
  6. Restart each node.

Results

Tombstones are removed when Cassandra is compacted, according to the settings in cassandra.yaml.