From 228727b1b07200b1cd1cc40721c414f2aa1f70ab Mon Sep 17 00:00:00 2001 From: OxalisCu <2127298698@qq.com> Date: Fri, 18 Oct 2024 17:30:51 +0800 Subject: [PATCH] feat: add s2s architecture svg & fix misrepresentation --- docs/.vitepress/zh.ts | 2 +- ...{architecture.svg => architecture-c2c.svg} | 198 +++++++------ docs/src/public/architecture-s2s.svg | 279 ++++++++++++++++++ docs/src/zh/guide/architecture.md | 30 +- 4 files changed, 404 insertions(+), 105 deletions(-) rename docs/src/public/{architecture.svg => architecture-c2c.svg} (88%) create mode 100644 docs/src/public/architecture-s2s.svg diff --git a/docs/.vitepress/zh.ts b/docs/.vitepress/zh.ts index 84b167cd..b17b7329 100644 --- a/docs/.vitepress/zh.ts +++ b/docs/.vitepress/zh.ts @@ -29,7 +29,7 @@ function sidebar(): DefaultTheme.SidebarItem[] { { text: '快速上手', link: '/zh/guide/getting-started' }, { text: '配置', link: '/zh/guide/config' }, { text: '迁移模式选择', link: '/zh/guide/mode' }, - { text: '集群同步架构', link: '/zh/guide/architecture' }, + { text: '架构与性能说明', link: '/zh/guide/architecture' }, ] }, { diff --git a/docs/src/public/architecture.svg b/docs/src/public/architecture-c2c.svg similarity index 88% rename from docs/src/public/architecture.svg rename to docs/src/public/architecture-c2c.svg index 451a620a..87d954eb 100644 --- a/docs/src/public/architecture.svg +++ b/docs/src/public/architecture-c2c.svg @@ -31,7 +31,7 @@ .st16 {fill:#feffff;font-family:Arial;font-size:0.833336em} .st17 {fill:#ffc000;stroke:#ffd965;stroke-width:0.25} .st18 {fill:#c55a11;stroke:#ed7d31;stroke-width:0.25} - .st19 {marker-end:url(#mrkr4-152);stroke:#c5e0b3;stroke-linecap:round;stroke-linejoin:round;stroke-width:1} + .st19 {marker-end:url(#mrkr4-129);stroke:#c5e0b3;stroke-linecap:round;stroke-linejoin:round;stroke-width:1} .st20 {fill:#c5e0b3;fill-opacity:1;stroke:#c5e0b3;stroke-opacity:1;stroke-width:0.28409090909091} .st21 {fill:none;fill-rule:evenodd;font-size:12px;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} ]]> @@ -45,7 +45,7 @@ markerUnits="strokeWidth" overflow="visible"> - @@ -370,113 +370,40 @@ Write - - 工作表.209 - - 矩形.85 - Write - - - - - - - - Write - - 矩形.7 - Reader Channel 1 - - - - - - - - ReaderChannel 1 - - 矩形.82 - - - - - - - - 工作表.84 - Goroutinue - - - - Goroutinue - - 矩形.57 - Parse, Filter, Function - - - - - - - - Parse, Filter, Function - - 矩形.148 - - - - - - - - 矩形.150 - Standalone Reader 1 - - - - - - - - StandaloneReader 1 - - + 动态连接线.210 - + 动态连接线.211 - + 动态连接线.212 - + 动态连接线.213 - + - + 动态连接线.214 - + 动态连接线.215 - + 工作表.216 Goroutinue Goroutinue - - 工作表.217 - + + 工作表.218 + 矩形.188 @@ -484,7 +411,7 @@ - + 矩形.185 @@ -492,14 +419,14 @@ - + 工作表.186 Goroutinue Goroutinue - + 矩形.187 Parse, Filter, Function @@ -511,7 +438,7 @@ Parse, Filter, Function - + 矩形.190 Standalone Reader 3 @@ -523,7 +450,7 @@ StandaloneReader 3 - + 矩形.206 Write @@ -534,7 +461,7 @@ Write - + 矩形.184 Reader Channel 2 @@ -546,6 +473,93 @@ ReaderChannel 2 + + 工作表.217 + Goroutinue + + + + Goroutinue + + + 工作表.220 + + 矩形.85 + Write + + + + + + + + Write + + 矩形.7 + Reader Channel 1 + + + + + + + + ReaderChannel 1 + + 矩形.82 + + + + + + + + 工作表.84 + Goroutinue + + + + Goroutinue + + 矩形.57 + Parse, Filter, Function + + + + + + + + Parse, Filter, Function + + 矩形.148 + + + + + + + + 矩形.150 + Standalone Reader 1 + + + + + + + + StandaloneReader 1 + + 工作表.219 + Goroutinue + + + + Goroutinue diff --git a/docs/src/public/architecture-s2s.svg b/docs/src/public/architecture-s2s.svg new file mode 100644 index 00000000..fce6281a --- /dev/null +++ b/docs/src/public/architecture-s2s.svg @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 页-1 + + + + 矩形.85 + Write + + + + + + + + Write + + 矩形.7 + Reader Channel + + + + + + + + ReaderChannel + + 矩形.235 + Redis Standalone + + + + + + + + Redis Standalone + + 矩形.237 + Redis Standalone + + + + + + + + Redis Standalone + + 矩形.38 + Writer Channel + + + + + + + + WriterChannel + + 工作表.250 + + 矩形.148 + + + + + + + + 矩形.150 + Standalone Reader + + + + + + + + StandaloneReader + + 工作表.229 + Goroutinue + + + + Goroutinue + + + 工作表.251 + + 矩形.82 + + + + + + + + 工作表.225 + Goroutinue + + + + Goroutinue + + 矩形.57 + Parse, Filter, Function + + + + + + + + Parse, Filter, Function + + + 工作表.252 + + 矩形.148 + + + + + + + + 工作表.233 + Goroutinue + + + + Goroutinue + + 矩形.150 + Standalone Writer + + + + + + + + StandaloneWriter + + + 动态连接线 + + + + 动态连接线.254 + + + + 动态连接线.255 + + + + 工作表.256 + Standalone Reader + + + + Standalone Reader + + 工作表.257 + Main + + + + Main + + 工作表.258 + Standalone Writer + + + + Standalone Writer + + 工作表.259 + Write directly + + + + Write directly + + 矩形.26 + + + + + + + + 工作表.265 + Source + + + + Source + + 矩形.266 + + + + + + + + 工作表.270 + Destination + + + + Destination + + diff --git a/docs/src/zh/guide/architecture.md b/docs/src/zh/guide/architecture.md index 3077ca05..8326b073 100644 --- a/docs/src/zh/guide/architecture.md +++ b/docs/src/zh/guide/architecture.md @@ -1,10 +1,14 @@ -# 集群同步架构 +# 架构与性能说明 ## 架构图 -当源端和目的端都为集群时,同步架构图如下。 +当源端和目的端都为集群(Cluster)时,同步架构图如下。 -![集群同步架构图](/architecture.svg) +![集群同步架构图](/architecture-c2c.svg) + +当源端和目的端为单实例节点(Standalone)时,同步架构图如下。 + +![单实例节点同步架构图](/architecture-s2s.svg) ## 架构说明 @@ -40,9 +44,11 @@ Cluster Writer 即集群写入类,根据目的端分片数量创建同等数 - redis-benchmark:redis 的压力测试工具,为源端创造持续的写入流量 -分别对 redisshake 两种模式 sync 和 scan,数据同步全量同步阶段(rdb)、增量同步阶段(aof)设计了测试案例。对于全量同步阶段,需要提前写入数据到源端,再开启 redisshake 同步;对于增量同步阶段,先开启 redisshake 开始同步,再利用 redis-benchmark 持续产生写入流量。 +分别对 redisshake 两种模式 sync 和 scan,数据同步全量同步和增量同步两个阶段设计了测试案例。对于全量同步阶段,需要提前写入数据到源端,再开启 redisshake 同步;对于增量同步阶段,先开启 redisshake 开始同步,再利用 redis-benchmark 持续产生写入流量。 + +其中,sync 模式下,全量同步阶段同步一个 rdb 文件,增量同步阶段则是 aof 数据流;在 scan 模式下,全量同步采用 scan 遍历源端数据库,增量同步阶段则是开启 ksn 进行键值同步。 -其中对于增量同步阶段,redis-benchmark 脚本设置如下,产生的写请求大概为 1500k/s,可以占满 ECS 服务器的前 16 个 cpu 内核。 +对于增量同步阶段,redis-benchmark 脚本设置如下,产生的写请求大概为 1500k/s,可以占满 ECS 服务器的前 16 个 cpu 内核。 ```bash taskset -c 0-15 redis-benchmark \ @@ -51,7 +57,7 @@ taskset -c 0-15 redis-benchmark \ --cluster -c 256 -d 8 -P 2 ``` -测试结果可见 [RedisShake 云端测试结果](https://github.com/OxalisCu/RedisShake/tree/benchmark-backup-cloud/demo) +测试结果可见 [RedisShake 云端性能测试结果](https://github.com/OxalisCu/RedisShake/tree/benchmark-backup-cloud/demo) ### 性能数据 @@ -67,16 +73,16 @@ taskset -c 0-15 redis-benchmark \ | --------------- | ----- | ------- | --------------- | --------------- | | **sync + aof** | 1599k | 1520k | 12*(130k)=1560k | 0.97 | | **sync + rdb** | | 1498k | 12*(220k)=2640k | 0.57 | -| **scan + aof** | 1084k | 1081k | 12*(95k)=1140k | 0.95 | -| **scan + rdb** | | 665k | 12*(58k)=696k | 0.95 | +| **scan + ksn** | 1084k | 1081k | 12*(95k)=1140k | 0.95 | +| **scan + scan** | | 665k | 12*(58k)=696k | 0.95 | ### 资源消耗 -cpu 占用和 io 速率采用 htop 工具监测,network 收发速率采用 iftop 工具监测,得到结果如下。 +cpu 占用和 disk 读写速率采用 htop 工具监测,network 收发速率采用 iftop 工具监测,得到结果如下。 -| | cpu | network | io | +| | cpu | network | disk | | --------------- | ----------------------------------- | ------------------------------------ | ---------- | | **sync + aof** | 16 核占用 70%-90%,总使用率 1276.9% | 发送速率 1340Mb/s,接收速率 998Mb/s | 155.91MB/s | | **sync + rdb** | 32 核占用 50%-60%,总使用率 1605.0% | 发送速率 435Mb/s,接收速率 82.1 Mb/s | 113.53KB/s | -| **scan + aof** | 16 核占用 90%-100%,总使用率 1911.4% | 发送速率 2100Mb/s,接收速率 1330 Mb/s | 172.07KB/s | -| **scan + rdb** | 32 核占用 40%-60%,总使用率 1297.2% | 发送速率 1130Mb/s,接收速率 533Mb/s | 155.78KB/s | \ No newline at end of file +| **scan + ksn** | 16 核占用 90%-100%,总使用率 1911.4% | 发送速率 2100Mb/s,接收速率 1330 Mb/s | 172.07KB/s | +| **scan + scan** | 32 核占用 40%-60%,总使用率 1297.2% | 发送速率 1130Mb/s,接收速率 533Mb/s | 155.78KB/s | \ No newline at end of file