temporalio / temporal

Temporal service
https://docs.temporal.io
MIT License
11.12k stars 798 forks source link

Cassandra schema should use default SizeTieredCompactionStrategy #3633

Open bschoening opened 1 year ago

bschoening commented 1 year ago

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:

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

jaffarsadikk commented 1 year ago

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

vikingUnet commented 5 months ago

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?