我曾被要求评估RabbitMQ而不是Kafka,但发现很难找到一个消息队列比Kafka更适合的情况。有人知道在哪些用例中消息队列在吞吐量、持久性、延迟或易用性方面更适合吗?
当前回答
Apache Kafka is a popular choice for powering data pipelines. Apache kafka added kafka stream to support popular etl use cases. KSQL makes it simple to transform data within the pipeline, readying messages to cleanly land in another system. KSQL is the streaming SQL engine for Apache Kafka. It provides an easy-to-use yet powerful interactive SQL interface for stream processing on Kafka, without the need to write code in a programming language such as Java or Python. KSQL is scalable, elastic, fault-tolerant, and real-time. It supports a wide range of streaming operations, including data filtering, transformations, aggregations, joins, windowing, and sessionization.
https://docs.confluent.io/current/ksql/docs/index.html
对于etl系统来说,Rabbitmq并不是一个受欢迎的选择,它更适合那些需要简单的消息传递系统和更低吞吐量的系统。
其他回答
RabbitMQ是一种传统的通用消息代理。它使web服务器能够快速响应请求,并将消息传递到多个服务。发布者能够发布消息并使其可用于队列,以便消费者可以检索它们。通信可以是异步的,也可以是同步的。
另一方面,Apache Kafka不仅仅是一个消息代理。它最初是由LinkedIn设计和实现的,用于作为消息队列。自2011年以来,Kafka已经开源,并迅速发展成为一个分布式流媒体平台,用于实现实时数据管道和流媒体应用程序。
它具有水平可扩展性、容错性、极快的速度和可磨合性 在数千家公司生产。
现代组织有各种各样的数据管道来促进系统或服务之间的通信。当相当数量的服务需要实时相互通信时,事情就变得有点复杂了。
The architecture becomes complex since various integrations are required in order to enable the inter-communication of these services. More precisely, for an architecture that encompasses m source and n target services, n x m distinct integrations need to be written. Also, every integration comes with a different specification, meaning that one might require a different protocol (HTTP, TCP, JDBC, etc.) or a different data representation (Binary, Apache Avro, JSON, etc.), making things even more challenging. Furthermore, source services might address increased load from connections that could potentially impact latency.
通过解耦数据管道,Apache Kafka带来了更简单、更易管理的体系结构。Kafka充当了一个高吞吐量的分布式系统,源服务在其中推送数据流,使它们可供目标服务实时提取。
另外,现在有很多开源的和企业级的用户界面来管理Kafka集群。有关更多详细信息,请参阅我的文章Apache Kafka集群的UI监控工具概述和为什么Apache Kafka?
使用RabbitMQ还是Kafka取决于项目的需求。一般来说,如果你想要一个简单的/传统的发布-订阅消息代理,那么选择RabbitMQ。如果你想构建一个事件驱动的体系结构,在此基础上你的组织将实时处理事件,那么选择Apache Kafka,因为它为这种体系结构类型提供了更多的功能(例如Kafka Streams或ksqlDB)。
你们忘记的一个关键区别是RabbitMQ是基于推的消息系统,而Kafka是基于拉的消息系统。这在消息传递系统必须满足具有不同处理能力的不同类型的消费者的场景中非常重要。使用基于Pull的系统,消费者可以根据自己的能力消费,而推送系统将推送消息,而不管消费者的状态如何,从而将消费者置于高风险之中。
简短的回答是“消息确认”。RabbitMQ可以配置为需要消息确认。如果接收方失败,消息将返回队列,另一个接收方可以再次尝试。虽然你可以用自己的代码在Kafka中完成这个任务,但它可以在RabbitMQ中开箱即用。
根据我的经验,如果你有一个需要查询信息流的应用程序,Kafka和KSql是你最好的选择。如果你想要一个排队系统,你最好使用RabbitMQ。
从技术上讲,与Rabbit MQ提供的特性集相比,Kafka提供了一个巨大的超特性集。
如果问题是
Rabbit MQ技术上比Kafka更好吗?
那么答案是
No.
但是,如果问题是
从业务角度看Rabbit MQ比Kafka好吗?
那么,答案是
在某些商业场景中,可能是“Yes”
从业务角度来看,Rabbit MQ可以比Kafka更好,原因如下:
Maintenance of legacy applications that depend on Rabbit MQ Staff training cost and steep learning curve required for implementing Kafka Infrastructure cost for Kafka is higher than that for Rabbit MQ. Troubleshooting problems in Kafka implementation is difficult when compared to that in Rabbit MQ implementation. A Rabbit MQ Developer can easily maintain and support applications that use Rabbit MQ. The same is not true with Kafka. Experience with just Kafka development is not sufficient to maintain and support applications that use Kafka. The support personnel require other skills like zoo-keeper, networking, disk storage too.
我能想到的唯一好处是事务性功能,其余的都可以用Kafka来完成
推荐文章
- RabbitMQ / AMQP:单队列,同一消息的多个消费者?
- 从RabbitMQ中删除所有队列?
- RabbitMQ与通道和连接之间的关系
- 重新安装后无法访问RabbitMQ web管理界面
- 卡夫卡在控制台生产
- 删除芹菜/ rabbitmq中所有挂起的任务
- 在卡夫卡的作品中,有没有一种方法可以清除这个话题?
- 是什么决定了Kafka的消费抵消?
- 为什么我们需要像RabbitMQ这样的消息代理而不是像PostgreSQL这样的数据库?
- 消息队列vs. Web服务?
- 使用Kafka作为(CQRS)事件存储。好主意吗?
- 理解Kafka主题和分区
- 何时在Kafka上使用RabbitMQ ?
- ActiveMQ或RabbitMQ或ZeroMQ或