参考:https://www.zhihu.com/question/30343125架构
二者虽然都是从传统的Pub/Sub消息系统演化出来的,可是进化的方向不同,如下是几个比较突出的点:分布式
说白了都是传统消息系统(老爸)的子嗣,只是与不一样的场景(老妈)结合的产物。不过,二者却能够结合起来使用。好比能够用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