From 8c885ad9a925db7601d53b012b1478f76e42c938 Mon Sep 17 00:00:00 2001 From: cfc4n Date: Wed, 10 Jun 2020 14:59:11 +0800 Subject: [PATCH] mvcc: chanLen 1024 is to biger,and it used more memory. 128 seems to be enough. Sometimes the consumption speed is more than the production speed. See https://github.com/etcd-io/etcd/issues/11906 for more detail. --- mvcc/watchable_store.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mvcc/watchable_store.go b/mvcc/watchable_store.go index 8f12bddba88..a2c6528d7dc 100644 --- a/mvcc/watchable_store.go +++ b/mvcc/watchable_store.go @@ -28,9 +28,8 @@ import ( var ( // chanBufLen is the length of the buffered chan // for sending out watched events. - // TODO: find a good buf value. 1024 is just a random one that - // seems to be reasonable. - chanBufLen = 1024 + // See https://github.com/etcd-io/etcd/issues/11906 for more detail. + chanBufLen = 128 // maxWatchersPerSync is the number of watchers to sync in a single batch maxWatchersPerSync = 512