问题
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