将Cassandra用作队列 [英] Using Cassandra as a Queue

查看:77
本文介绍了将Cassandra用作队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Cassandra用作队列:

Using Cassandra as Queue:

真的那么糟糕吗?

设置:5个节点群集,所有操作均按法定人数执行

Setup: 5 node cluster, all operations execute at quorum

使用DateTieredCompaction可以大大降低TombStones的成本,并允许立即删除整个SSTable.

Using DateTieredCompaction should significantly reduce the cost of TombStones, and allow entire SSTables to be dropped at once.

  • 我们将所有消息添加到具有相同TTL的队列中
  • 我们根据时间(例如1分钟间隔)对邮件进行分区,并跟踪读取位置.
  • 消耗的消息将被明确删除.(只有1个线程提取消息)
  • 某些消息可能会在读取之前被明确删除(即,读取位置之后我们可能有墓碑).(即最初使用的TTL是上限)gc_grace可能会设置为0,因为仲裁读取将执行阻塞修复(即,由于消息仅驻留在1个群集(DC)中,因此我们可以关闭修复,并且所有操作法定人数))
  • 只能添加/删除邮件,不允许更新.
  • 在我们的用例中,如果一个墓碑不复制它并不重要,那么我们可以偶尔多次看到相同的消息.(此外,由于所有操作都在法定人数上执行,因此我们可能不会定期运行修复".)

有想法吗?

推荐答案

通常,这是一种反模式,此链接讨论了对墓碑的大部分影响:

Generally, it is an anti-pattern, this link talks much of the impact on tombstone: http://www.datastax.com/dev/blog/cassandra-anti-patterns-queues-and-queue-like-datasets

我的观点是,如果可能的话,请尽量避免这种情况,但是如果您真的了解性能影响,并且这不是体系结构中的问题,那么您当然可以这样做.

My opinion is, try to avoid that if possible, but if you really understand the performance impact, and it is not an issue in your architecture, of course you could do that.

如果可能的话,不这样做的另一个原因是,cassandra数据结构不是为队列设计的,它看起来总是丑陋的,丑陋的!

Another reason to not do that if possible is, the cassandra data structure is not designed for queues, it will always look ugly, UGLY!

强烈建议在做出最终决定之前考虑使用Redis或RabbitMQ.

Strongly suggest to consider Redis or RabbitMQ before making your final decision.

这篇关于将Cassandra用作队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆