From 847d786535cf2222b6851d612ce36f32e0ef813e Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Fri, 21 Jun 2024 15:18:05 +0700 Subject: [PATCH] e2: configurable hashers amount (#10785) --- erigon-lib/downloader/downloadercfg/downloadercfg.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erigon-lib/downloader/downloadercfg/downloadercfg.go b/erigon-lib/downloader/downloadercfg/downloadercfg.go index a9aaf1beccc..d1051af0b97 100644 --- a/erigon-lib/downloader/downloadercfg/downloadercfg.go +++ b/erigon-lib/downloader/downloadercfg/downloadercfg.go @@ -17,6 +17,7 @@ package downloadercfg import ( + "github.com/ledgerwatch/erigon-lib/common/dbg" "net" "net/url" "os" @@ -65,7 +66,7 @@ func Default() *torrent.ClientConfig { // better don't increase because erigon periodically producing "new seedable files" - and adding them to downloader. // it must not impact chain tip sync - so, limit resources to minimum by default. // but when downloader is started as a separated process - rise it to max - //torrentConfig.PieceHashersPerTorrent = cmp.Max(1, runtime.NumCPU()-1) + torrentConfig.PieceHashersPerTorrent = dbg.EnvInt("DL_HASHERS", min(16, max(2, runtime.NumCPU()-2))) torrentConfig.MinDialTimeout = 6 * time.Second //default: 3s torrentConfig.HandshakesTimeout = 8 * time.Second //default: 4s