How can I optimize a Cassandra queue-like column family?

落花浮王杯 提交于 2019-12-11 10:53:35

问题


I have a queue-like column family which updates frequently around every hour. After a couple of hours or a day cassandra has a lot of read time outs.

I have tried this but haven't gotten the result yet: gc_grace_seconds = 0 and using LeveledCompaction.

Or would you recommend the datetieredcompactionstrategy or is there another better strategy then these two?

If I cannot solve this I am thinking switching to another database do you think that is necessary?

Thanks for your replies.


回答1:


What your doing is an anti-pattern and has a lot of issues tied to it which is important to point out.

That said you really want to keep your tombstones under control, as you get more and more cause a lot of GC issues and increase read latencies (has to read a lot of data off disk to read the empty queue). You are probably not getting the benefit of your gc_grace setting of zero due to the default tombstone_compaction_interval.

I would suggest you update your compaction strategy to help:

ALTER TABLE footable WITH
  compaction = {'class': 'LeveledCompactionStrategy', 
    'sstable_size_in_mb': '256mb',
    'tombstone_compaction_interval': '1',
    'unchecked_tombstone_compaction': 'true',
    'tombstone_threshold': '0.05'} AND 
  gc_grace_seconds = 0

Keep in mind that more aggressive tombstone removal creates a possibility for a delete to be "lost". Really, if possible, you should look into updating your application to use something more suitable.



来源:https://stackoverflow.com/questions/37178966/how-can-i-optimize-a-cassandra-queue-like-column-family

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!