temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Cassandra schema should use default SizeTieredCompactionStrategy

Open bschoening opened this issue 2 years ago • 2 comments

The Cassandra schema uses LevelTieredCompaction (LCS) but likely should use default SizeTieredCompactionStrategy (STCS) instead. All of the tables seem to be configured with LCS but this is not a good general purpose configuration.

Level compaction (LCS) can involve significant write magnification, where data is re-written multiple times. In performance testing, reports show up to 13-fold write amplification with LCS. This blog article by ScyllaDB - a Cassandra compatible database -discusses the many downsides to using LCS:

  • https://www.scylladb.com/2018/01/31/compaction-series-leveled-compaction/

The default STCS is preferred and works well for most workloads.

bschoening avatar Nov 21 '22 18:11 bschoening

Hi Brad, It looks Temporal by default creating table using SizeTieredCompactionStrategy (STCS) ie., schema_version & schema_update_history tables, rest of them manually specifing compaction strategy is LevelTieredCompaction (LCS).

https://github.com/temporalio/temporal/blob/master/schema/cassandra/temporal/schema.cql#L53

jaffarsadikk avatar Nov 22 '22 10:11 jaffarsadikk

Hello again! Thanks for answer, but why rest of tables indeed have old LevelTieredCompaction (LCS) instead more common and robust compaction type SizeTieredCompactionStrategy (STCS) ? Is this a secret meaning in that, or we can change compaction type of all tables on Size Tired compaction type by ourselfs?

vikingUnet avatar Mar 15 '24 08:03 vikingUnet