Hi Vincent,

Is that a good pattern for Cassandra? Is there some compaction tunings I should take into account?
Actually it depends on how you use Cassandra :). If you use it as key-value storage TTL works fine. But if you would use rather complex CQL queries to this table I not sure that it would be good.

With this structure is obvious that after one week inserting data, from that moment there's gonna be new expired columns every 5 minutes in that table. Because of that I've noticed that this table is being compacted every 5 minutes.
Compaction doesn't triggered when some column expired. It triggered on gc_grace_seconds timeout and according compaction strategy. You can see more detailed description of LeveledCompactionStrategy in following article: Leveled compaction in Cassandra.

There are 2 types of compaction: minor and major, which kind of compaction do you see and how come to conclusion that compaction triggered every 5 minutes? If you see major compaction that situation is very bad otherwise it is normal case.

--
Thanks,
Sergey



On 06/04/14 15:48, Vicent Llongo wrote:
Hi there,

I have this table where I'm inserting timeseries values with a TTL of 86400*7 (1week):

CREATE TABLE metrics_5min (
  object_id varchar,
  metric varchar,
  ts timestamp,
  val double,
  PRIMARY KEY ((object_id, metric), ts)
)
WITH gc_grace_seconds = 86400
AND compaction = {'class': 'LeveledCompactionStrategy', 'sstable_size_in_mb' : 100};


With this structure is obvious that after one week inserting data, from that moment there's gonna be new expired columns every 5 minutes in that table. Because of that I've noticed that this table is being compacted every 5 minutes.

Is that a good pattern for Cassandra? Is there some compaction tunings I should take into account?

Thanks!