From 652a34ef572e3cfa03ab98467224eb83bb3cf510 Mon Sep 17 00:00:00 2001 From: agapple Date: Fri, 20 Jul 2018 14:33:48 +0800 Subject: [PATCH] Created Performance (markdown) --- Performance.md | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 Performance.md diff --git a/Performance.md b/Performance.md new file mode 100644 index 0000000..7ec1b1b --- /dev/null +++ b/Performance.md @@ -0,0 +1,135 @@ +# 测试环境 + +| 类型 | 配置 | +| --- | --- | +| MySQL A | Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (24core 96G) | +| MySQL B | Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (24core 96G) 日常业务库 | +| Canal Server | Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (24core 96G) | +| Canal Client | Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (24core 96G) | + + +# 测试方式 + +为了更加精准的描述canal的性能,会从整个流程上进行优化和分析.   具体优化思路参考:[https://github.com/alibaba/canal/issues/726](https://github.com/alibaba/canal/issues/726) + +1. 整个canal流程处理binlog,分为这么5步操作(4+1),整个优化和评测对这5步分别进行. + + +![image.png | left | 747x237](https://cdn.yuque.com/lark/0/2018/png/5565/1532057042091-3ad852d4-6346-4c7d-b94b-327baba85010.png "") + +2. 构造了两个测试场景,批量Insert/Update/Delete 和 普通业务DB(单条操作为主) + +# 测试数据 + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
序号
+
+
阶段
+
+
批量操作Insert/Update/Delete (导入业务)
+
+
单条操作 (普通业务)
+
+
1
+
+
Binlog接收
+
+
200w TPS (网络 117MB/s)
+
+
71w TPS (网络 112MB/s)
+
+
2
+
+
Binlog Event解析
+
+
200w TPS (网络 117MB/s)
+
+
70w TPS (网络 110MB/s)
+
+
3
+
+
Insert/Update/Delete深度解析
+
+
200w TPS (网络 117MB/s)
+
+
65w TPS (网络 105MB/s)
+
+
4
+
+
生成CanalEntry (存储到memory store)
+
+
130w TPS (网络 75MB/s)
+
+
50w TPS (网络 90MB/s)
+
+
5
+
+
client接收
+
+
20w TPS 1.canal server机器网络 11MB/s
+
2.canal client机器网络 75MB/s
+
+ binlog膨胀率为 1:6.8
+
+
10w TPS 1.canal server网络 22MB/s
+
2.canal client网络 42MB/s
+
+
binlog膨胀率为 1:1.9
+
+
+ + +# 小结 + +   从最开始接收(跑满网络带宽)到最后client机器收到格式化的binlog数据,binlog解析的5个阶段是一个漏斗形的性能。目前整个阶段4->阶段5,性能下降比较明显主要是因为网络传输、序列化的代价影响,binlog接收为了保序采用了串行方式,所以串行里的每个代码逻辑处理都会影响最后吞吐。 + so. 如果基于canal做额外的数据扩展,比如对接到MQ系统,可以在步骤3、4阶段介入,最大化的吞吐. + +结论数据: +1. 1.0.26经过优化之后的性能,从业务binlog入库到canal client拿到数据,基本可以达到10~20w的TPS. +2. 单纯的binlog解析能力可以跑到60w ~ 200w的TPS,相当于100MB/s的解析速度