kafka和mqtt的区别和联系

参考:https://www.zhihu.com/question/30343125架构

二者虽然都是从传统的Pub/Sub消息系统演化出来的,可是进化的方向不同,如下是几个比较突出的点:分布式

  1. Kafka是为了数据集成的场景,与以往Pub/Sub消息总线不同,经过分布式架构提供了海量消息处理、高容错的方式存储海量数据流、保证数据流的顺序等特性。能够参考云上的卡夫卡 - 数据工会
  2. MQTT是为了物联网场景而优化,不但提供多个QoS选项(exact once、at least once、at most once),并且还有层级主题、遗嘱等等特性。能够参考MQTT入门篇 - 数据工会

说白了都是传统消息系统(老爸)的子嗣,只是与不一样的场景(老妈)结合的产物。不过,二者却能够结合起来使用。好比能够用MQTT接受物联网设备上传的数据,而后接入Kafka,最后能够同时分发到HDFS归档、数据仓库作OLAP分析、Elasticsearch作全文检索,这样的架构很是适合大型物联网项目,不但可以处理海量数据同时也具备很好的扩展性。优化

MQTT and Kafka, on paper, are publish/subscribe (pub/sub) messaging platforms. But a key distinction between the two relates to how they are put to use. Unlike Kafka, MQTT is a machine-to-machine (M2M) messaging protocol. This means that while Kafka is responsible for data management and ingestion into computation systems, MQTT specializes in data packet exchange between two physical devices. In our home automation example, if we want to adjust air conditioning according to ambient temperature, the temperature sensor must be able to communicate with the air conditioner. This communication is held through MQTT. As expected, MQTT is only intended for small-sized data sets, where responsiveness and power efficiency are prioritized. This doesn’t lend well to large data sets – the result being bad scaling. Kafka, on the other hand, is designed specifically with massive data feeds in mind. Sound IoT systems use Kafka and MQTT in conjunction, co-existing separately for maximum performance and scalability.ui

相关文章
相关标签/搜索