From 24e8c4f712f95d7586b87bfaef48658a17653414 Mon Sep 17 00:00:00 2001 From: vinllen Date: Mon, 12 Aug 2019 19:52:45 +0800 Subject: [PATCH] set sender count to 4096 if target redis type is cluster --- conf/redis-shake.conf | 2 +- src/redis-shake/main/main.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/redis-shake.conf b/conf/redis-shake.conf index 08b30dc..281578f 100644 --- a/conf/redis-shake.conf +++ b/conf/redis-shake.conf @@ -189,7 +189,7 @@ sender.size = 104857600 # sender flush buffer size of oplog number. # used in `sync`. # 发送缓存的报文个数,超过这个阈值将会强行刷缓存发送 -sender.count = 5000 +sender.count = 4096 # delay channel size. once one oplog is sent to target redis, the oplog id and timestamp will also # stored in this delay queue. this timestamp will be used to calculate the time delay when receiving # ack from target redis. diff --git a/src/redis-shake/main/main.go b/src/redis-shake/main/main.go index 3ee087c..a6fa959 100644 --- a/src/redis-shake/main/main.go +++ b/src/redis-shake/main/main.go @@ -396,6 +396,9 @@ func sanitizeOptions(tp string) error { // set to default when not set conf.Options.SenderCount = defaultSenderCount } + if conf.Options.TargetType == conf.RedisTypeCluster && conf.Options.SenderCount > utils.RecvChanSize { + conf.Options.SenderCount = utils.RecvChanSize + } if conf.Options.SenderDelayChannelSize == 0 { conf.Options.SenderDelayChannelSize = 32