在上一篇磨刀不误砍柴工:我们的硬件基准性能大摸底中,我们搞清楚了测试环境的硬件天花板。现在,让我们把主角请上场——Apache RocketMQ

作为分布式系统的核心“动脉”,消息队列的选型直接关系到整个系统的稳定性和上限。这次,我们将对 RocketMQ 进行一次无死角的深度解剖,从不同硬件、不同版本,再到自建与云服务的终极对决,用数据说话,把它的性能、优劣、坑点一次性聊个透。

1. 硬件差异:闪存卡 vs. 高性能 SSD

这三组摸高数据的系统配置并不一致(例如:闪存卡环境为 CPU:24核 内存:40G,SSD 环境为 CPU:8核 内存:16G,云组件为托管规格),因此不能仅凭 TPS 数字直接得出“SSD 全面优于闪存卡”的结论。更准确的说法是:RocketMQ 的吞吐与延迟同时受 I/O 形态整机规格(CPU/内存/网络) 共同影响,做横向对比前必须把变量(刷盘策略、队列数、消息大小、并发等)尽可能对齐。

为了让结论可复现、可核对,下面把本次摸高测试的原始结果表格直接放出来。

1.1 自建 RocketMQ(闪存卡)摸高数据

MQ集群架构 序号 测试场景 脚本 发送最大 TPS 最大 RT 平均 RT MQ内存配置 发送最大 TPS 只起主broker 最大 RT 只起主broker 平均 RT 只起主broker
2 主 2 从 1 1 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1024 -n x.x.x.x:9876 3144 154 0.323 8G
2 1 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 2048 -n x.x.x.x:9876 2888 150 0.349 8G
3 1 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1024 -n x.x.x.x:9876 3238 147 0.312 8G
4 1 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 2048 -n x.x.x.x:9876 2893 150 0.347 8G
5 10 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1024 -n x.x.x.x:9876 16364 157 0.614 8G
6 10 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 2048 -n x.x.x.x:9876 16368 154 0.611 8G
7 10 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1024 -n x.x.x.x:9876 16338 156 0.618 8G
8 10 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 2048 -n x.x.x.x:9876 16132 160 0.623 8G
9 30 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1024 -n x.x.x.x:9876 42426 295 0.724 8G
10 30 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 2048 -n x.x.x.x:9876 38897 2569 0.817 8G
11 30 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1024 -n x.x.x.x:9876 41721 206 0.735 8G
12 30 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 2048 -n x.x.x.x:9876 39375 199 0.766 8G
13 60 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1024 -n x.x.x.x:9876 66780 228 0.91 8G 98508 221 0.638
14 60 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 2048 -n x.x.x.x:9876 58957 400 1.052 8G 90222 216 0.699
15 60 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1024 -n x.x.x.x:9876 65105 239 0.936 8G 96854 225 0.632
16 60 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 2048 -n x.x.x.x:9876 60051 517 1.073 8G 88002 220 0.7
17 120 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1024 -n x.x.x.x:9876 89263 782 1.438 8G 120612 282 1.02
18 120 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 2048 -n x.x.x.x:9876 76838 818 1.776 8G 108242 315 1.539
19 120 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1024 -n x.x.x.x:9876 89222 320 1.469 8G 122808 299 1.038
20 120 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 2048 -n x.x.x.x:9876 74445 431 1.749 8G 110954 304 1.101
21 200 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1024 -n x.x.x.x:9876 102751 463 2.237 8G
22 200 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 2048 -n x.x.x.x:9876 82284 426 2.67 8G
23 200 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 1024 -n x.x.x.x:9876 99661 420 2.28 8G
24 200 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 2048 -n x.x.x.x:9876 78859 549 2.698 8G
4 主 4 从 1 1 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1024 -n x.x.x.x:9876 3016 157 0.34 8G 4350 154 0.233
2 1 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 2048 -n x.x.x.x:9876 2698 151 0.368 8G 3660 161 0.275
3 1 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1024 -n x.x.x.x:9876 2983 150 0.337 8G 4299 158 0.24
4 1 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 2048 -n x.x.x.x:9876 2767 150 0.362 8G 3664 159 0.279
5 10 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1024 -n x.x.x.x:9876 17543 172 0.574 8G 24699 165 0.407
6 10 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 2048 -n x.x.x.x:9876 16558 160 0.611 8G 23429 162 0.428
7 10 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1024 -n x.x.x.x:9876 16623 161 0.611 8G 24507 158 0.412
8 10 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 2048 -n x.x.x.x:9876 14698 167 0.689 8G 23283 155 0.439
9 30 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1024 -n x.x.x.x:9876 40048 228 0.772 8G 60206 226 0.503
10 30 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 2048 -n x.x.x.x:9876 33667 236 0.929 8G 55057 239 0.547
11 30 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1024 -n x.x.x.x:9876 35435 245 0.902 8G 56956 231 0.552
12 30 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 2048 -n x.x.x.x:9876 32202 253 0.98 8G 50020 240 0.635
13 60 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1024 -n x.x.x.x:9876 56913 311 1.095 8G 97765 301 0.621
14 60 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 2048 -n x.x.x.x:9876 49226 301 1.263 8G 85178 2227 0.719
15 60 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1024 -n x.x.x.x:9876 8G 85591 852 0.7223
16 60 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 2048 -n x.x.x.x:9876 8G 77104 302 0.793
17 120 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1024 -n x.x.x.x:9876 8G 146523 549 0.859
18 120 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 2048 -n x.x.x.x:9876 8G 130222 516 1.02
19 120 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1024 -n x.x.x.x:9876 8G 131290 511 0.943
20 120 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 2048 -n x.x.x.x:9876 8G 120828 456 1.033
21 200 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1024 -n x.x.x.x:9876 8G 156279 606 1.335
22 200 个线程、消息大小为 2K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 2048 -n x.x.x.x:9876 8G 137191 752 1.478
23 200 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 150 -s 1024 -n x.x.x.x:9876 8G 156851 644 1.329
24 200 个线程、消息大小为 2K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 2048 -n x.x.x.x:9876 8G 143658 627 1.438
数量 系统配置
4 CPU:24核 内存:40G 硬盘闪存卡:2T

1.2 云上自建 RocketMQ(SSD)摸高数据

MQ集群架构 序号 测试场景 脚本 MQ内存配置 测试结果 发送最大 TPS 最大 RT(ms) 平均 RT (ms) 主brocker CPU(%) 主brocker 内存(%) 主brocker io(%)
1 主 2 从 1 1 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 1024 -n x.x.x.x:9876 8G Send TPS: 741 Max RT(ms): 200 Average RT(ms): 1.349 741 200 1.349 12.67 63.58 1.55
2 1 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 5120 -n x.x.x.x:9876 8G Send TPS: 684 Max RT(ms): 200 Average RT(ms): 1.460 684 200 1.46 12.66 63.58 1.36
3 1 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 10240-n x.x.x.x:9876 8G Send TPS: 626 Max RT(ms): 201 Average RT(ms): 1.595 626 201 1.695 20 93 2
4 1 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 1048576-n x.x.x.x:9876 8G Send TPS: 60 Max RT(ms): 307 Average RT(ms): 16.569 60 307 16.569 41 93 4
5 1 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1024 -n x.x.x.x:9876 8G Send TPS: 697 Max RT(ms): 191 Average RT(ms): 1.433 697 191 1.433 18 93 2
6 1 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 5120 -n x.x.x.x:9876 8G Send TPS: 637 Max RT(ms): 194 Average RT(ms): 1.568 637 194 1.568 16 93 2
7 1 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 10240-n x.x.x.x:9876 8G Send TPS: 670 Max RT(ms): 194 Average RT(ms): 1.492 670 194 1.492 19 93 2
8 1 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1048576-n x.x.x.x:9876 8G Send TPS: 60 Max RT(ms): 251 Average RT(ms): 16.460 60 251 16.46 37 93 4
9 1 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1024 -n x.x.x.x:9876 8G Send TPS: 651 Max RT(ms): 216 Average RT(ms): 1.535 651 216 1.535 17 93 2
10 1 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 5120 -n x.x.x.x:9876 8G Send TPS: 635 Max RT(ms): 189 Average RT(ms): 1.573 635 189 1.573 18 93 2
11 1 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 10240-n x.x.x.x:9876 8G Send TPS: 592 Max RT(ms): 214 Average RT(ms): 1.686 592 214 1.686 17 93 2
12 1 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1048576-n x.x.x.x:9876 8G Send TPS: 58 Max RT(ms): 244 Average RT(ms): 17.063 58 244 17.063 37 93 4
13 10 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 1024 -n x.x.x.x:9876 8G Send TPS: 6707 Max RT(ms): 252 Average RT(ms): 1.491 6707 252 1.491 67 65.8 2.14
14 10 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 5120 -n x.x.x.x:9876 8G Send TPS: 5566 Max RT(ms): 244 Average RT(ms): 1.796 5566 244 1.796 79 71.1 2.79
15 10 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 10240-n x.x.x.x:9876 8G Send TPS: 5924 Max RT(ms): 260 Average RT(ms): 1.687 5924 260 1.687 105.7 84.9 3.33
16 10 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 1048576-n x.x.x.x:9876 8G Send TPS: 88 Max RT(ms): 374 Average RT(ms): 112.483 88 374 112.483 74 94.7 4.81
17 10 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1024 -n x.x.x.x:9876 8G Send TPS: 6400 Max RT(ms): 239 Average RT(ms): 1.56 6400 239 1.56 64.7 61.5 2.48
18 10 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 5120 -n x.x.x.x:9876 8G Send TPS: 6130 Max RT(ms): 250 Average RT(ms): 1.631 6130 250 1.631 88 73.7 3.68
19 10 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 10240-n x.x.x.x:9876 8G Send TPS: 5980 Max RT(ms): 241 Average RT(ms): 1.672 5980 241 1.672 113.3 85.1 5.41
20 10 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1048576-n x.x.x.x:9876 8G Send TPS: 82 Max RT(ms): 405 Average RT(ms): 120.935 82 405 120.935 73.3 94.4 3.9
21 10 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1024 -n x.x.x.x:9876 8G Send TPS: 6507 Max RT(ms): 256 Average RT(ms): 1.536 6507 256 1.536 150.8 61.9 4.23
22 10 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 5120 -n x.x.x.x:9876 8G Send TPS: 5853 Max RT(ms): 257 Average RT(ms): 1.708 5853 257 1.708 326.7 71.7 3.86
23 10 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 10240-n x.x.x.x:9876 8G Send TPS: 5875 Max RT(ms): 254 Average RT(ms): 1.701 5875 254 1.701 373.3 85 5
24 10 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1048576-n x.x.x.x:9876 8G Send TPS: 82 Max RT(ms): 421 Average RT(ms): 120.770 82 421 120.77 206.7 94.3 3.19
25 30 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 1024 -n x.x.x.x:9876 8G Send TPS: 21716 Max RT(ms): 296 Average RT(ms): 1.381 21716 296 1.381 209 66.4 2.23
26 30 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16419 Max RT(ms): 333 Average RT(ms): 1.827 16419 333 1.827 173.7 94.6 5.66
27 30 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 10240-n x.x.x.x:9876 8G Send TPS: 9647 Max RT(ms): 279 Average RT(ms): 3.109 9647 279 3.109 134.6 94 6.49
28 30 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 1048576-n x.x.x.x:9876 8G Send TPS: 83 Max RT(ms): 648 Average RT(ms): 360.794 83 648 360.794 76.7 94.6 4.9
29 30 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1024 -n x.x.x.x:9876 8G Send TPS: 17361 Max RT(ms): 329 Average RT(ms): 1.728 17361 329 1.728 266.7 68.2 3.51
30 30 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16683 Max RT(ms): 268 Average RT(ms): 1.798 16683 268 1.798 170 94.2 8.2
31 30 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 10240-n x.x.x.x:9876 8G Send TPS: 9318 Max RT(ms): 294 Average RT(ms): 3.219 9318 294 3.219 136.5 94.4 6.99
32 30 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1048576-n x.x.x.x:9876 8G Send TPS: 82 Max RT(ms): 661 Average RT(ms): 363.915 82 661 363.915 106.3 94.3 3
33 30 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1024 -n x.x.x.x:9876 8G Send TPS: 19097 Max RT(ms): 268 Average RT(ms): 1.571 19097 268 1.571 333.3 68.5 5.84
34 30 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 5120 -n x.x.x.x:9876 8G Send TPS: 14938 Max RT(ms): 258 Average RT(ms): 2.008 14938 258 2.008 268.4 92.9 8.19
35 30 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 10240-n x.x.x.x:9876 8G Send TPS: 8311 Max RT(ms): 284 Average RT(ms): 3.609 8311 284 3.609 460 94 7.33
36 30 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1048576-n x.x.x.x:9876 8G Send TPS: 81 Max RT(ms): 631 Average RT(ms): 366.094 81 631 366.094 86.3 94.5 3.89
37 60 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 1024 -n x.x.x.x:9876 8G Send TPS: 32127 Max RT(ms): 425 Average RT(ms): 1.867 32127 425 1.867 218.3 75.8 3.78
38 60 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16349 Max RT(ms): 510 Average RT(ms): 3.670 16349 510 3.67 159 94.6 3.92
39 60 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 10240-n x.x.x.x:9876 8G Send TPS: 9013 Max RT(ms): 403 Average RT(ms): 6.656 9013 403 6.656 132 94.7 6.1
40 60 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 1048576-n x.x.x.x:9876 8G Send TPS: 95 Max RT(ms): 940 Average RT(ms): 631.760 95 940 631.76 71 94.5 5.82
41 60 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1024 -n x.x.x.x:9876 8G Send TPS: 34931 Max RT(ms): 419 Average RT(ms): 1.717 34931 419 1.717 247 77.1 4.12
42 60 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 5120 -n x.x.x.x:9876 8G Send TPS: 18528 Max RT(ms): 356 Average RT(ms): 3.238 18528 356 3.238 178.3 94.2 7.77
43 60 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 10240-n x.x.x.x:9876 8G Send TPS: 8299 Max RT(ms): 406 Average RT(ms): 7.229 8299 406 7.229 122.7 94.5 4.42
44 60 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1048576-n x.x.x.x:9876 8G Send TPS: 94 Max RT(ms): 995 Average RT(ms): 631.884 94 995 631.884 200 94.7 4.22
45 60 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1024 -n x.x.x.x:9876 8G Send TPS: 34947 Max RT(ms): 443 Average RT(ms): 1.717 34947 443 1.717 253.3 76.9 7.13
46 60 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16731 Max RT(ms): 429 Average RT(ms): 3.586 16731 429 3.586 211.6 94 9.25
47 60 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 10240-n x.x.x.x:9876 8G Send TPS: 8988 Max RT(ms): 470 Average RT(ms): 6.675 8988 470 6.675 215.7 94 9.3
48 60 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1048576-n x.x.x.x:9876 8G Send TPS: 94 Max RT(ms): 948 Average RT(ms): 632.989 94 948 632.989 113.3 94.5 4.02
50 120 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 1024 -n x.x.x.x:9876 8G Send TPS: 51946 Max RT(ms): 982 Average RT(ms): 2.310 51946 982 2.31 283 93 6
51 120 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 5120 -n x.x.x.x:9876 8G Send TPS: 18211 Max RT(ms): 917 Average RT(ms): 6.589 18211 917 6.589 173 93 8
52 120 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 10240-n x.x.x.x:9876 8G Send TPS: 8943 Max RT(ms): 778 Average RT(ms): 13.419 8943 778 13.419 126 93 5
53 120 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 1048576-n x.x.x.x:9876 8G Send TPS: 94 Max RT(ms): 1724 Average RT(ms): 1268.168 94 1724 1268.168 59 93 5
54 120 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1024 -n x.x.x.x:9876 8G Send TPS: 52499 Max RT(ms): 1032 Average RT(ms): 2.286 52499 1032 2.286 286 85.6 7.43
55 120 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16772 Max RT(ms): 722 Average RT(ms): 7.154 16772 722 7.154 170.1 94.1 5.3
56 120 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 10240-n x.x.x.x:9876 8G Send TPS: 8792 Max RT(ms): 740 Average RT(ms): 13.648 8792 740 13.648 129 94.5 7
57 120 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1048576-n x.x.x.x:9876 8G Send TPS: 88 Max RT(ms): 1790 Average RT(ms): 1350.527 88 1790 1350.527 133.3 94.4 5.16
58 120 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1024 -n x.x.x.x:9876 8G Send TPS: 51700 Max RT(ms): 857 Average RT(ms): 2.321 51700 857 2.321 500 88.6 5.52
59 120 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16041 Max RT(ms): 825 Average RT(ms): 7.480 16041 825 7.48 249.2 94.2 6.34
60 120 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 10240-n x.x.x.x:9876 8G Send TPS: 8849 Max RT(ms): 713 Average RT(ms): 13.560 8849 713 13.56 202.3 94 8.17
61 120 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1048576-n x.x.x.x:9876 8G Send TPS: 88 Max RT(ms): 1823 Average RT(ms): 1350.728 88 1823 1350.728 82 84.6 5.76
62 200 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 1024 -n x.x.x.x:9876 8G Send TPS: 61074 Max RT(ms): 1580 Average RT(ms): 3.274 61074 1580 3.274 315 93 7
63 200 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 5120 -n x.x.x.x:9876 8G Send TPS: 15903 Max RT(ms): 1116 Average RT(ms): 12.575 15903 1116 12.575 161.7 94.6 4.97
64 200 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 10240-n x.x.x.x:9876 8G Send TPS: 8455 Max RT(ms): 995 Average RT(ms): 23.655 8455 995 23.655 122.7 94.7 4.85
65 200 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 1048576-n x.x.x.x:9876 8G Send TPS: 92 Max RT(ms): 2739 Average RT(ms): 2177.139 92 2739 2177.139 70.4 94.6 4.3
66 200 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1024 -n x.x.x.x:9876 8G Send TPS: 64279 Max RT(ms): 1245 Average RT(ms): 3.111 64279 1245 3.111 310 92.7 9.43
67 200 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 5120 -n x.x.x.x:9876 8G Send TPS: 16836 Max RT(ms): 1076 Average RT(ms): 11.879 16836 1076 11.879 169 94 6.18
68 200 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 10240-n x.x.x.x:9876 8G Send TPS: 9527 Max RT(ms): 1018 Average RT(ms): 20.995 9527 1018 20.995 141.2 94.3 7.09
69 200 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1048576-n x.x.x.x:9876 8G Send TPS: 95 Max RT(ms): 2700 Average RT(ms): 2106.977 95 2700 2106.977 66.7 94.4 6.05
70 200 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 1024 -n x.x.x.x:9876 8G Send TPS: 64697 Max RT(ms): 1286 Average RT(ms): 3.091 64697 1286 3.091 345.3 92.3 10.65
71 200 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 5120 -n x.x.x.x:9876 8G Send TPS: 18383 Max RT(ms): 1298 Average RT(ms): 10.880 18383 1298 10.88 287 94.2 6.33
72 200 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 10240-n x.x.x.x:9876 8G Send TPS: 9588 Max RT(ms): 1075 Average RT(ms): 20.857 9588 1075 20.857 202.3 93.6 9.71
73 200 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 1048576-n x.x.x.x:9876 8G Send TPS: 89 Max RT(ms): 2855 Average RT(ms): 2249.820 89 2855 2249.82 83.3 94.4 3.47
数量 系统配置
4 CPU:8核 内存:16G 硬盘SSD:300G

1.3 云组件 RocketMQ 摸高数据

MQ集群架构 序号 测试场景 脚本 MQ内存配置 测试结果 发送最大 TPS 最大 RT(ms) 平均 RT (ms) 主brocker CPU(%) 主brocker 内存(%)
1 主 2 从 1 1 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 1024 -n x.x.x.x:9876 8G 334 190 3.186 0.08 50.76
2 1 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 1 -s 1048576-n x.x.x.x:9876 8G 35 258 28.631 0.2 50.83
3 1 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1024 -n x.x.x.x:9876 8G 323 189 3.218 0.1 50.96
4 1 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 1 -s 1048576-n x.x.x.x:9876 8G 35 265 30.077 0.16 51.07
5 1 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1024 -n x.x.x.x:9876 8G 310 200 3.274 0.14
6 1 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 1 -s 1048576-n x.x.x.x:9876 8G 37 250 26.904 0.21 51.22
7 10 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 1024 -n x.x.x.x:9876 8G 2953 221 3.504 0.31
8 10 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 10 -s 1048576-n x.x.x.x:9876 8G 83 448 145.769 0.34
9 10 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1024 -n x.x.x.x:9876 8G Send TPS: 2949 Max RT(ms): 217 Average RT(ms): 3.390 2949 217 3.39 0.1 50.11
10 10 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 10 -s 1048576-n x.x.x.x:9876 8G 81 484 140.121 0.52
11 10 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1024 -n x.x.x.x:9876 8G 2957 214 3.483 0.24
12 10 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 5120 -n x.x.x.x:9876 8G 2887 217 3.532 0.2
13 10 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 10240-n x.x.x.x:9876 8G 2578 225 3.878 0.18
14 10 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 10 -s 1048576-n x.x.x.x:9876 8G 92 486 116.217 0.74 51.59
15 30 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 1024 -n x.x.x.x:9876 8G 8474 315 3.641 0.34
16 30 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 30 -s 1048576-n x.x.x.x:9876 8G 82 794 408.172 0.36
17 30 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1024 -n x.x.x.x:9876 8G Send TPS: 7718 Max RT(ms): 332 Average RT(ms): 3.887 7718 332 3.887 0.15 50
18 30 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 30 -s 1048576-n x.x.x.x:9876 8G 82 917 432.663 0.45
19 30 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1024 -n x.x.x.x:9876 8G 8947 324 3.547 0.45
20 30 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 30 -s 1048576-n x.x.x.x:9876 8G 88 878 425.53 0.74 51.59
21 60 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 1024 -n x.x.x.x:9876 8G 16177 480 3.907 0.57
22 60 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 60 -s 1048576-n x.x.x.x:9876 8G 91 1063 772.185 0.57
23 60 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1024 -n x.x.x.x:9876 8G Send TPS: 15078 Max RT(ms): 459 Average RT(ms): 3.979 14728 482 4.444 0.52
24 60 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 60 -s 1048576-n x.x.x.x:9876 8G 106 1039 609.305 0.76
25 60 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1024 -n x.x.x.x:9876 8G 16184 445 3.892 0.53
26 60 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 60 -s 1048576-n x.x.x.x:9876 8G 92 1244 754.828 0.5 51.92
27 120 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 1024 -n x.x.x.x:9876 8G 25790 759 5.037 0.73
28 120 个线程、消息大小为 5K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 5120 -n x.x.x.x:9876 8G 14346 779 8.905 0.94
29 120 个线程、消息大小为 10K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 10240-n x.x.x.x:9876 8G 9018 696 14.383 1.18
30 120 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 120 -s 1048576-n x.x.x.x:9876 8G 95 2019 1471.131 0.85
31 120 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1024 -n x.x.x.x:9876 8G Send TPS: 23634 Max RT(ms): 782 Average RT(ms): 5.077 24028 782 5.114 0.88 56.56
32 120 个线程、消息大小为 5K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 5120 -n x.x.x.x:9876 8G 16783 742 7.387 0.93
33 120 个线程、消息大小为 10K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 10240-n x.x.x.x:9876 8G 10423 696 12.352 1.11
34 120 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 120 -s 1048576-n x.x.x.x:9876 8G 90 2119 1526.396 0.71 52.97
35 120 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1024 -n x.x.x.x:9876 8G 24737 754 5.433 1.11
36 120 个线程、消息大小为 5K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 5120 -n x.x.x.x:9876 8G 13865 757 8.797 1.02
37 120 个线程、消息大小为 10K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 10240-n x.x.x.x:9876 8G 9284 658 14.387 0.8
38 120 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 120 -s 1048576-n x.x.x.x:9876 8G 90 2056 1460.819 0.65 52.22
39 200 个线程、消息大小为 1K、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 1024 -n x.x.x.x:9876 8G 31711 1321 7.2 1.08
40 200 个线程、消息大小为 1M、主题为 1 个队列 sh producer.sh -t cluster-perf-tst1 -w 200 -s 1048576-n x.x.x.x:9876 8G 105 2752 2174.336 0.64
41 200 个线程、消息大小为 1K、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1024 -n x.x.x.x:9876 8G Send TPS: 29804 Max RT(ms): 1058 Average RT(ms): 6.709 31234 1058 7.192 1.13 50.74
42 200 个线程、消息大小为 1M、主题为 8 个队列 sh producer.sh -t cluster-perf-tst8 -w 200 -s 1048576-n x.x.x.x:9876 8G 109 2703 2030.028 0.52 52.92
43 200 个线程、消息大小为 1K、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 1024 -n x.x.x.x:9876 8G 30011 1252 7.813 1.06
44 200 个线程、消息大小为 1M、主题为 16 个队列 sh producer.sh -t cluster-perf-tst16 -w 200 -s 1048576-n x.x.x.x:9876 8G 105 2709 2104.359 0.47 52.61
系统配置
rocketmq.4u8g.cluster * 1 broker 服务:6900元/月 只提供超高速IO

2. 版本对决:RocketMQ 4.7.1 vs. 5.3.1

本次公开导出的原始数据未包含 4.7.15.3.1 的版本对比压测表,因此本文不基于数字给出“版本谁更强”的结论。实际选型时,建议把版本差异当作必须回归的变量,至少覆盖以下维度:

  • 消息大小矩阵:1K / 10K / 1M(以及业务真实的“大消息”分布)。
  • 刷盘与复制:同步刷盘/异步刷盘、同步复制/异步复制。
  • 观测指标:峰值 TPS、平均 RT、最大 RT、长尾(P99/P999)与尖刺频率。

3. 调优之妙:别让默认配置拖后腿

在这轮压测中,我们没有把“参数组合对照表”作为主线展开(它更适合作为团队内部的运行手册),但确实可以给出几个最容易踩坑、也最值得优先关注的参数方向:

  • sendMessageThreadPoolNums: Producer 的发送线程池。在高并发场景下,默认值往往是瓶颈,建议根据 CPU 核数适当调大。
  • flushDiskType: 刷盘策略。ASYNC_FLUSH(异步刷盘)能带来巨大的性能提升,但会牺牲少量可靠性。SYNC_FLUSH(同步刷盘)最可靠,但性能最低。需要根据业务容忍度进行权衡。
  • useReentrantLockWhenPutMessage: 在 Broker 端,当消息写入 CommitLog 时是否使用可重入锁。在高并发写入场景下,开启此项(设置为 true)可以减少锁竞争,提升 TPS。

4. 终极对决:自建 vs. 华为云 DMS

最后,我们将自建的 RocketMQ 集群,与云组件 RocketMQ 做了同场景对比。对比表格里同时给出了 TPS、平均 RT、最大 RT,适合直接做选型决策。

下面先给出一段“代表性场景摘录”,便于快速把握趋势:

测试场景 自部署 TPS 自部署 平均RT(ms) 云组件 TPS 云组件 平均RT(ms) TPS 倍率(云/自)
1 个线程、消息大小为 1K、主题为 1 个队列 741.0 1.35 334.0 3.19 0.45x
10 个线程、消息大小为 1K、主题为 1 个队列 6707 1.49 2953 3.50 0.44x
120 个线程、消息大小为 1K、主题为 1 个队列 51946 2.31 25790 5.04 0.50x
200 个线程、消息大小为 1K、主题为 1 个队列 61074 3.27 31711 7.20 0.52x
120 个线程、消息大小为 10K、主题为 8 个队列 8792 13.65 10423 12.35 1.19x

如果需要逐行核对全部场景,原始对比表如下:

测试场景 类型 更优 发送最大 TPS 最大 RT(ms) 平均 RT (ms)
1 个线程、消息大小为 10K、主题为 1 个队列 自部署 626 201 1.695
1 个线程、消息大小为 10K、主题为 16 个队列 自部署 592 214 1.686
1 个线程、消息大小为 10K、主题为 8 个队列 自部署 670 194 1.492
1 个线程、消息大小为 1K、主题为 1 个队列 自部署 741 200 1.349
1 个线程、消息大小为 1K、主题为 1 个队列 云组件 334 190 3.186
1 个线程、消息大小为 1K、主题为 16 个队列 自部署 651 216 1.535
1 个线程、消息大小为 1K、主题为 16 个队列 云组件 310 200 3.274
1 个线程、消息大小为 1K、主题为 8 个队列 自部署 697 191 1.433
1 个线程、消息大小为 1K、主题为 8 个队列 云组件 323 189 3.218
1 个线程、消息大小为 1M、主题为 1 个队列 自部署 60 307 16.569
1 个线程、消息大小为 1M、主题为 1 个队列 云组件 35 258 28.631
1 个线程、消息大小为 1M、主题为 16 个队列 自部署 58 244 17.063
1 个线程、消息大小为 1M、主题为 16 个队列 云组件 37 250 26.904
1 个线程、消息大小为 1M、主题为 8 个队列 自部署 60 251 16.46
1 个线程、消息大小为 1M、主题为 8 个队列 云组件 35 265 30.077
1 个线程、消息大小为 5K、主题为 1 个队列 自部署 684 200 1.46
1 个线程、消息大小为 5K、主题为 16 个队列 自部署 635 189 1.573
1 个线程、消息大小为 5K、主题为 8 个队列 自部署 637 194 1.568
10 个线程、消息大小为 10K、主题为 1 个队列 自部署 5924 260 1.687
10 个线程、消息大小为 10K、主题为 16 个队列 自部署 5875 254 1.701
10 个线程、消息大小为 10K、主题为 16 个队列 云组件 2578 225 3.878
10 个线程、消息大小为 10K、主题为 8 个队列 自部署 5980 241 1.672
10 个线程、消息大小为 1K、主题为 1 个队列 自部署 6707 252 1.491
10 个线程、消息大小为 1K、主题为 1 个队列 云组件 2953 221 3.504
10 个线程、消息大小为 1K、主题为 16 个队列 自部署 6507 256 1.536
10 个线程、消息大小为 1K、主题为 16 个队列 云组件 2957 214 3.483
10 个线程、消息大小为 1K、主题为 8 个队列 自部署 6400 239 1.56
10 个线程、消息大小为 1K、主题为 8 个队列 云组件 2949 217 3.39
10 个线程、消息大小为 1M、主题为 1 个队列 自部署 88 374 112.483
10 个线程、消息大小为 1M、主题为 1 个队列 云组件 83 448 145.769
10 个线程、消息大小为 1M、主题为 16 个队列 自部署 82 421 120.77
10 个线程、消息大小为 1M、主题为 16 个队列 云组件 92 486 116.217
10 个线程、消息大小为 1M、主题为 8 个队列 自部署 82 405 120.935
10 个线程、消息大小为 1M、主题为 8 个队列 云组件 81 484 140.121
10 个线程、消息大小为 5K、主题为 1 个队列 自部署 5566 244 1.796
10 个线程、消息大小为 5K、主题为 16 个队列 自部署 5853 257 1.708
10 个线程、消息大小为 5K、主题为 16 个队列 云组件 2887 217 3.532
10 个线程、消息大小为 5K、主题为 8 个队列 自部署 6130 250 1.631
120 个线程、消息大小为 10K、主题为 1 个队列 自部署 8943 778 13.419
120 个线程、消息大小为 10K、主题为 1 个队列 云组件 9018 696 14.383
120 个线程、消息大小为 10K、主题为 16 个队列 自部署 8849 713 13.56
120 个线程、消息大小为 10K、主题为 16 个队列 云组件 9284 658 14.387
120 个线程、消息大小为 10K、主题为 8 个队列 自部署 8792 740 13.648
120 个线程、消息大小为 10K、主题为 8 个队列 云组件 10423 696 12.352
120 个线程、消息大小为 1K、主题为 1 个队列 自部署 51946 982 2.31
120 个线程、消息大小为 1K、主题为 1 个队列 云组件 25790 759 5.037
120 个线程、消息大小为 1K、主题为 16 个队列 自部署 51700 857 2.321
120 个线程、消息大小为 1K、主题为 16 个队列 云组件 24737 754 5.433
120 个线程、消息大小为 1K、主题为 8 个队列 自部署 52499 1032 2.286
120 个线程、消息大小为 1K、主题为 8 个队列 云组件 24028 782 5.114
120 个线程、消息大小为 1M、主题为 1 个队列 自部署 94 1724 1268.168
120 个线程、消息大小为 1M、主题为 1 个队列 云组件 95 2019 1471.131
120 个线程、消息大小为 1M、主题为 16 个队列 自部署 88 1823 1350.728
120 个线程、消息大小为 1M、主题为 16 个队列 云组件 90 2056 1460.819
120 个线程、消息大小为 1M、主题为 8 个队列 自部署 88 1790 1350.527
120 个线程、消息大小为 1M、主题为 8 个队列 云组件 90 2119 1526.396
120 个线程、消息大小为 5K、主题为 1 个队列 自部署 18211 917 6.589
120 个线程、消息大小为 5K、主题为 1 个队列 云组件 14346 779 8.905
120 个线程、消息大小为 5K、主题为 16 个队列 自部署 16041 825 7.48
120 个线程、消息大小为 5K、主题为 16 个队列 云组件 13865 757 8.797
120 个线程、消息大小为 5K、主题为 8 个队列 自部署 16772 722 7.154
120 个线程、消息大小为 5K、主题为 8 个队列 云组件 16783 742 7.387
200 个线程、消息大小为 10K、主题为 1 个队列 自部署 8455 995 23.655
200 个线程、消息大小为 10K、主题为 16 个队列 自部署 9588 1075 20.857
200 个线程、消息大小为 10K、主题为 8 个队列 自部署 9527 1018 20.995
200 个线程、消息大小为 1K、主题为 1 个队列 自部署 61074 1580 3.274
200 个线程、消息大小为 1K、主题为 1 个队列 云组件 31711 1321 7.2
200 个线程、消息大小为 1K、主题为 16 个队列 自部署 64697 1286 3.091
200 个线程、消息大小为 1K、主题为 16 个队列 云组件 30011 1252 7.813
200 个线程、消息大小为 1K、主题为 8 个队列 自部署 64279 1245 3.111
200 个线程、消息大小为 1K、主题为 8 个队列 云组件 31234 1058 7.192
200 个线程、消息大小为 1M、主题为 1 个队列 自部署 92 2739 2177.139
200 个线程、消息大小为 1M、主题为 1 个队列 云组件 105 2752 2174.336
200 个线程、消息大小为 1M、主题为 16 个队列 自部署 89 2855 2249.82
200 个线程、消息大小为 1M、主题为 16 个队列 云组件 105 2709 2104.359
200 个线程、消息大小为 1M、主题为 8 个队列 自部署 95 2700 2106.977
200 个线程、消息大小为 1M、主题为 8 个队列 云组件 109 2703 2030.028
200 个线程、消息大小为 5K、主题为 1 个队列 自部署 15903 1116 12.575
200 个线程、消息大小为 5K、主题为 16 个队列 自部署 18383 1298 10.88
200 个线程、消息大小为 5K、主题为 8 个队列 自部署 16836 1076 11.879
30 个线程、消息大小为 10K、主题为 1 个队列 自部署 9647 279 3.109
30 个线程、消息大小为 10K、主题为 16 个队列 自部署 8311 284 3.609
30 个线程、消息大小为 10K、主题为 8 个队列 自部署 9318 294 3.219
30 个线程、消息大小为 1K、主题为 1 个队列 自部署 21716 296 1.381
30 个线程、消息大小为 1K、主题为 1 个队列 云组件 8474 315 3.641
30 个线程、消息大小为 1K、主题为 16 个队列 自部署 19097 268 1.571
30 个线程、消息大小为 1K、主题为 16 个队列 云组件 8947 324 3.547
30 个线程、消息大小为 1K、主题为 8 个队列 自部署 17361 329 1.728
30 个线程、消息大小为 1K、主题为 8 个队列 云组件 7718 332 3.887
30 个线程、消息大小为 1M、主题为 1 个队列 自部署 83 648 360.794
30 个线程、消息大小为 1M、主题为 1 个队列 云组件 82 794 408.172
30 个线程、消息大小为 1M、主题为 16 个队列 自部署 81 631 366.094
30 个线程、消息大小为 1M、主题为 16 个队列 云组件 88 878 425.53
30 个线程、消息大小为 1M、主题为 8 个队列 自部署 82 661 363.915
30 个线程、消息大小为 1M、主题为 8 个队列 云组件 82 917 432.663
30 个线程、消息大小为 5K、主题为 1 个队列 自部署 16419 333 1.827
30 个线程、消息大小为 5K、主题为 16 个队列 自部署 14938 258 2.008
30 个线程、消息大小为 5K、主题为 8 个队列 自部署 16683 268 1.798
60 个线程、消息大小为 10K、主题为 1 个队列 自部署 9013 403 6.656
60 个线程、消息大小为 10K、主题为 16 个队列 自部署 8988 470 6.675
60 个线程、消息大小为 10K、主题为 8 个队列 自部署 8299 406 7.229
60 个线程、消息大小为 1K、主题为 1 个队列 自部署 32127 425 1.867
60 个线程、消息大小为 1K、主题为 1 个队列 云组件 16177 480 3.907
60 个线程、消息大小为 1K、主题为 16 个队列 自部署 34947 443 1.717
60 个线程、消息大小为 1K、主题为 16 个队列 云组件 16184 445 3.892
60 个线程、消息大小为 1K、主题为 8 个队列 自部署 34931 419 1.717
60 个线程、消息大小为 1K、主题为 8 个队列 云组件 14728 482 4.444
60 个线程、消息大小为 1M、主题为 1 个队列 自部署 95 940 631.76
60 个线程、消息大小为 1M、主题为 1 个队列 云组件 91 1063 772.185
60 个线程、消息大小为 1M、主题为 16 个队列 自部署 94 948 632.989
60 个线程、消息大小为 1M、主题为 16 个队列 云组件 92 1244 754.828
60 个线程、消息大小为 1M、主题为 8 个队列 自部署 94 995 631.884
60 个线程、消息大小为 1M、主题为 8 个队列 云组件 106 1039 609.305
60 个线程、消息大小为 5K、主题为 1 个队列 自部署 16349 510 3.67
60 个线程、消息大小为 5K、主题为 16 个队列 自部署 16731 429 3.586
60 个线程、消息大小为 5K、主题为 8 个队列 自部署 18528 356 3.238

结论(以表格为准):这轮数据并不是“谁全面碾压谁”的故事。低并发/小消息场景下,自建的 TPS 更高、平均 RT 更低;但在并发拉高、消息变大后,云组件在部分场景会反超或缩小差距,同时最大 RT 的波动也更可控。更重要的是,云组件在扩容、监控、治理能力上带来的确定性,往往比几千 TPS 的差异更能降低系统风险。


本篇小结

  • 硬件是基础:RocketMQ 的上限离不开优质 I/O 与足够的 CPU/内存。
  • 版本需谨慎:版本对比需要用业务负载做回归压测,不能只看版本号“追新”。
  • 调优是关键:合理的参数配置能榨干硬件的每一滴性能。
  • 性能互有胜负:从同场景对比表看,小消息场景自建 TPS/平均 RT 更优;部分场景云组件会反超或最大 RT 更可控,且治理能力更强。

那么,性能的领先是否就意味着我们应该无脑选择云服务?成本呢?下一篇,我们将聚焦于另一个核心组件——Redis,并开始深入探讨“钱”的问题。