What is the difference between Apache kafka vs ActiveMQ

[亡魂溺海] 提交于 2019-12-18 10:55:34

问题


I am working on Apache Kafka. I want to know which one is better: Kafka or ActiveMQ. What is the main difference between this two technologies? I want to implement Kafka in Spring MVC.


回答1:


Kafka and ActiveMQ may have some overlaps but they were originally designed for different purposes. So comparing them is just like comparing an Apple and an Orange.

Kafka

Kafka is a distributed streaming platform with very good horizontal scaling capability. It allows applications to process and re-process streamed data on disk. Due to it's high throughput it's commonly used for real-time data streaming.

ActiveMQ

ActiveMQ is a general-purpose message broker that supports several messaging protocols such as AMQP, STOMP, MQTT. It supports more complicated message routing patterns as well as the Enterprise Integration Patterns. In general it is mainly used for integration between applications/services especially in a Service Oriented Architecture.




回答2:


I think one thing that should be noted in a discussion about which brokers to use (and when Kafka comes up) is that the Kafka benchmark that is frequently referenced shows the upper limit of any modern distributed computer. Today's brokers all have about the same total capacity in MB/s. Kafka does extremely well with small messages (10-1024 bytes) when compared to other brokers, but still limits out at around the ~75 Mb/s mark.

There is frequently an apples-to-oranges comparison esp when talking "clustering". ActiveMQ and other enterprise brokers cluster the publishing of messages and the tracking of consumer subscriptions. Kafka clusters the publishing and requires the consumer to track subscription. Seems minimal, but its a significant difference.

All brokers have the same back pressure issues-- Kafka can do a "LAZY PERSISTENCE" where the producer isn't waiting around for the broker to sync to disk.. this is good for a lot of use cases, but probably not the I-care-about-every-single-message scenario ppatierno mentions in his slide show.

Kafka really good for horizontal scaling for things like big data processing of small messages. ActiveMQ is more ideal for the class of use case frequently referred to as enterprise messaging (this is just a term, doesn't mean Kafka isn't good for the enterprise)-- transacted data (although Kafka is adding this).. kiosk.. retail store.. store and forward.. dmz traversal.. data center-to-data center publishing.. etc




回答3:


Kafka Architecture is different to ActiveMQ.

In Kafka, producer will publish messages to topic, which is a stream of messages of a particular type. Consumer will subscribe to one or more topics of brokers by pulling the data.

Key differences:

  1. Kafka producer doesn’t wait for acknowledgements from the broker. Overall throughput will be high if broker can handle the messages as fast as producer. ActiveMQ had to maintain the delivery state of every message.

  2. Kafka has a more efficient storage format. On average, each message had an overhead of 9 bytes in Kafka, versus 144 bytes in ActiveMQ. This means that ActiveMQ was using 70% more space than Kafka.

  3. Kafka is pull based messaging system and ActiveMQ is push based messaging system. Publisher will send message to all consumers in ActiveMQ. Consumer will pull messages at his own time in Kafka.

  4. In Kafka - A consumer can rewind back to an old offset and re-consume data. It is useful when you fix some issue and decide to re-play the old messages post issue resolution.

Due to above efficiencies, Kafka throughput is 2x - 4x times more than normal messaging systems like ActiveMQ and RabbitMQ.

More details can be read at notes.stephenholiday.com




回答4:


I hear this question every week... While ActiveMQ (like IBM MQ or JMS in general) is used for traditional messaging, Apache Kafka is used as streaming platform (messaging + distributed storage + processing of data). Both are built for different use cases.

You can use Kafka for "traditional messaging", but not use MQ for Kafka-specific scenarios.

The article “Apache Kafka vs. Enterprise Service Bus (ESB)—Friends, Enemies, or Frenemies? (https://www.confluent.io/blog/apache-kafka-vs-enterprise-service-bus-esb-friends-enemies-or-frenemies/)” discusses why Kafka is not competitive but complementary to integration and messaging solutions (including ActiveMQ) and how to integrate both.



来源:https://stackoverflow.com/questions/44792604/what-is-the-difference-between-apache-kafka-vs-activemq

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