Kafka vs. RocketMQ- Multiple Topic Stress Test Results

Introduction

This post delves into how we will simulate the real scenarios below:

  • Message sending and subscription must be concomitant.
  • Multiple subscription ends supported to subscribe only to messages you are interested in.

The focus of this post is on Kafka and RocketMQ, since they both are high-performance applications. Thus, we will target these two products to see which one of them is better in the above scenarios. Before we begin, let’s clarify two concepts first:

What is a Topic?

Topic is an important concept in message-oriented middleware. Every topic represents a message category. With multiple topics, we can categorize and isolate messages.

You can refer to the feeding models in a zoo in the figure below. Every animal can only consume the specific corresponding food.

What is a Partition?

Both Kafka and RocketMQ adopt message queues on disks. For the same consumption group, a partition only supports message consumption by one consumption thread. Too few partitions may cause the consumption speed to lag far behind the message generation speed. In actual production environments, a topic will be set in the multi-partition mode to support multiple consumers, as shown in the figure below:

Many topics and environments exist in an actual production environment of internet enterprises. Such production environment requires the message-oriented middleware to guarantee the service stability in the coexistence of multiple topics. Let's move on to the testing step to check the handling capacities of Kafka and RocketMQ on multiple topics when message sending and subscription ends coexist.

Testing Objective

We will compare the impact of the number of topics on the performances of Kafka and RocketMQ when sending and receiving ends coexist. In this case, we adopt eight partitions. However, in this stress test, we only pay attention to the performance indicators of the service end. Therefore, the “Exit” criteria for the stress test are as given below.

Keep increasing the stress on the sending end until the system throughput does not increase and the response takes longer. At this time, a performance bottleneck emerges on the service end. Obtain the corresponding optimal throughput of the system, ensuring that there are no messages accumulated throughout the process.

Test scenarios

By default, every topic has eight partitions; every topic matches one subscriber, and the number of topics is increased gradually. The data obtained is as follows:

We can see that no matter how many topics there are, both Kafka and RocketMQ can maintain flat TPS on the sending and receiving ends. Simply put, no message accumulation occurs.

Based on the changes in number of topics, we can draw the curves of message handling capacities of Kafka and RocketMQ, as shown in the figure below:

From the figure above we can see that:

  • When the number of topics increases from 64 to 256, the throughput of Kafka dropped by 98.37%.
  • When the number of topics increases from 64 to 256, the throughput of RocketMQ dropped by only 16%.

Why the huge difference? The difference is attributable to the fact that every topic and partition of Kafka correspond to one physical file. When the number of topics increases, the policy of deconcentrated storage of messages to disks will lead to disk IO competition to cause performance bottlenecks. In contrast, all the messages in RocketMQ are stored in the same physical file. The number of topics and partitions is just a logic division for RocketMQ. So the increasing number of topics won't generate a huge impact on the RocketMQ performance.

Test conclusion

When the message sending and consumption ends coexist, the increasing number of topics will cause a drastic decline of Kafka's throughput, while RocketMQ delivers a stable performance. Therefore, Kafka is more suitable for business scenarios with only a few topics and consumption ends, while RocketMQ is a better choice for business scenarios with multiple topics and consumption ends.

Appendix:

Test environment

The service end is deployed in the standalone mode. The server configurations are as follows:

Application version:

Test scripts

Summary

In the test above, we saw how RocketMQ almost overwhelms Kafka. The result is hardly surprising because RocketMQ is born to target internet production requirements. Readers now should understand why RocketMQ manages to support the massive messaging services of Alibaba group.

The stress test of multiple-topic scenarios involved in the test only lasted 20 minute. Too short an execution period for a message-oriented middleware product, hence inadequate to identify its stability.

时间: 2024-10-28 09:34:34

Kafka vs. RocketMQ- Multiple Topic Stress Test Results的相关文章

Kafka vs RocketMQ——Topic数量对单机性能的影响

引言 上一期我们对比了三类消息产品(Kafka.RabbitMQ.RocketMQ)单纯发送小消息的性能,受到了程序猿们的广泛关注,其中大家对这种单纯的发送场景感到并不过瘾,因为没有任何一个网站的业务只有发送消息.本期,我们就来模拟一个真实的场景: 消息的发送和订阅一定是共存的 要支持多个订阅端订阅自己感兴趣的消息 鉴于上一期Kafka和RocketMQ的指标和关注度很高,本期我们将只针对这两个产品,对比在上述场景中,究竟谁更胜一筹.在正式开始测试之前,首先要向大家明确2个概念: Topic为何

Kafka vs RocketMQ——单机系统可靠性

引言 前几期的评测中,我们对比了Kafka和RocketMQ的吞吐量和稳定性,本期我们要引入一个新的评测标准--软件可靠性. 何为"可靠性"? 先看下面这种情况:有A,B两辆越野汽车,在城市的周边地区均能很好应对泥泞的路况.当一同开去穿越西藏,A车会因为西藏本地的汽油不达标,导致油路受阻无法点火,而B车顺利完成了穿越.因此我们说,B车的可靠性比A车高. 何为"软件可靠性"? "软件的可靠性"就是考察软件在各种异常突发的情况下的应对能力.常见的软件

Kafka vs RocketMQ—— Topic数量对单机性能的影响

引言 上一期我们对比了三类消息产品(Kafka.RabbitMQ.RocketMQ)单纯发送小消息的性能,受到了程序猿们的广泛关注,其中大家对这种单纯的发送场景感到并不过瘾,因为没有任何一个网站的业务只有发送消息.本期,我们就来模拟一个真实的场景: 消息的发送和订阅一定是共存的 要支持多个订阅端订阅自己感兴趣的消息 鉴于上一期Kafka和RocketMQ的指标和关注度很高,本期我们将只针对这两个产品,对比在上述场景中,究竟谁更胜一筹.在正式开始测试之前,首先要向大家明确2个概念: Topic为何

Kafka VS RocketMQ VS RabbitMQ

- - kafka RocketMQ RabbitMQ 数据来源 相关文章 定位 设计定位 系统间的数据流管道,实时数据处理. 例如:常规的消息系统.网站活性跟踪,监控数据,日志收集.处理等 非日志的可靠消息传输. 例如:订单,交易,充值,流计算,消息推送,日志流式处理,binglog分发等 可靠消息传输.和RocketMQ类似. 基础对比 成熟度 日志领域成熟  成熟  成熟  所属社区/公司 Apache  Alibaba开发,已加入到Apache下 Mozilla Public Licen

Kafka、RabbitMQ、RocketMQ发送小消息性能对比

引言 分布式系统中,我们广泛运用消息中间件进行系统间的数据交换,便于异步解耦.现在开源的消息中间件有很多,前段时间我们自家的产品 RocketMQ (MetaQ的内核) 也顺利开源,得到大家的关注.那么,消息中间件性能究竟哪家强? 带着这个疑问,我们中间件测试组对常见的三类消息产品(Kafka.RabbitMQ.RocketMQ)做了性能比较. Kafka是LinkedIn开源的分布式发布-订阅消息系统,目前归属于Apache定级项目.Kafka主要特点是基于Pull的模式来处理消息消费,追求高

业界主流MQ对比

根据之前的学习和沉淀,本期我们总结了几款业界主流消息中间件产品的对比报告: 如有不准确的地方,请指正. 相关链接 Kafka.RabbitMQ.RocketMQ发送小消息性能对比 Kafka vs RocketMQ--Topic数量对单机性能的影响 Kafka vs RocketMQ-- 多Topic对性能稳定性的影响 Kafka vs RocketMQ--单机系统可靠性 Kafka vs RocketMQ--消息及时性对比

Kafka、RabbitMQ、RocketMQ消息中间件的对比—— 消息发送性能

引言 分布式系统中,我们广泛运用消息中间件进行系统间的数据交换,便于异步解耦.现在开源的消息中间件有很多,前段时间我们自家的产品 RocketMQ (MetaQ的内核) 也顺利开源,得到大家的关注. 那么,消息中间件性能究竟哪家强? 带着这个疑问,我们中间件测试组对常见的三类消息产品(Kafka.RabbitMQ.RocketMQ)做了性能比较.   Kafka是LinkedIn开源的分布式发布-订阅消息系统,目前归属于Apache定级项目.Kafka主要特点是基于Pull的模式来处理消息消费,

消息中间件kafka与activemq、rabbitmq、zeromq、rocketmq的比较

  消息队列(Message Queue,简称 MQ)是阿里巴巴集团中间件技术部自主研发的专业消息中间件. 分布式消息系统作为实现分布式系统可扩展.可伸缩性的关键组件,需要具有高吞吐量.高可用等特点.而谈到消息系统的设计,就回避不了两个问题: 常用消息队列有:kafka.activemq.rabbitmq等.   一.kafka: 1.不完全符合jms规范,注重吞吐量,类似udp 和 tcp: 2.一般做大数据吞吐的管道 我们现在的用途就是负责在各个idc之间通信: 3.量大 对数据不是百分之百

kafka彻底删除topic

今天发现一个线上kafka(版本为0.8.2.2)多天前已不再消费的topic标记为删除(marked for deletion),而我们每天有定时删除topic的shell脚本,会把无用的topic干掉,但发现这些topic只是被标记为删除,而并没有真正删除,其server.properties的相关配置如下: delete.topic.enable=true log.retention.hours=72 既然自动删除没起作用(后来探查到原因是我们的监控服务还在访问这个topic),那就手动删