From 2f999d8607309977515de598b9fa17ccaea69e03 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 6 Jul 2023 00:46:22 +0300 Subject: [PATCH] Reduce etcd memory usage With default --snapshot-count 100000 and GOGC=100 it easily reaches 6.6 GB even when we only store 1-2 MB of data in it --- mon/make-etcd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mon/make-etcd b/mon/make-etcd index 2673825c..85e3e920 100755 --- a/mon/make-etcd +++ b/mon/make-etcd @@ -63,8 +63,9 @@ Wants=network-online.target local-fs.target time-sync.target [Service] Restart=always +Environment=GOGC=50 ExecStart=etcd -name etcd${num} --data-dir /var/lib/etcd${num}.etcd \\ - --advertise-client-urls http://${etcds[num]}:2379 --listen-client-urls http://${etcds[num]}:2379 \\ + --snapshot-count 10000 --advertise-client-urls http://${etcds[num]}:2379 --listen-client-urls http://${etcds[num]}:2379 \\ --initial-advertise-peer-urls http://${etcds[num]}:2380 --listen-peer-urls http://${etcds[num]}:2380 \\ --initial-cluster-token vitastor-etcd-1 --initial-cluster ${etcd_cluster} \\ --initial-cluster-state new --max-txn-ops=100000 --max-request-bytes=104857600 \\