From c9f5c5623f44b1b6043783ffe2889ec8d1791753 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 10 Aug 2020 15:15:37 +0300 Subject: [PATCH] app/vmselect/netstorage: vary batch size for data unpacking depending on the available CPU cores This should reduce contention on the channel with unpack work for systems with high number of CPU cores --- app/vmselect/netstorage/netstorage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 70ce87ccd3..f61d5d1fdd 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -251,7 +251,7 @@ func unpackWorker() { // unpackBatchSize is the maximum number of blocks that may be unpacked at once by a single goroutine. // // This batch is needed in order to reduce contention for upackWorkCh in multi-CPU system. -const unpackBatchSize = 16 +var unpackBatchSize = 8 * runtime.GOMAXPROCS(-1) // Unpack unpacks pts to dst. func (pts *packedTimeseries) Unpack(tbf *tmpBlocksFile, dst *Result, tr storage.TimeRange, fetchData bool, at *auth.Token) error {