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
This commit is contained in:
Aliaksandr Valialkin 2020-08-10 15:15:37 +03:00
parent 4ce1368e4b
commit c9f5c5623f

View file

@ -251,7 +251,7 @@ func unpackWorker() {
// unpackBatchSize is the maximum number of blocks that may be unpacked at once by a single goroutine. // 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. // 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. // Unpack unpacks pts to dst.
func (pts *packedTimeseries) Unpack(tbf *tmpBlocksFile, dst *Result, tr storage.TimeRange, fetchData bool, at *auth.Token) error { func (pts *packedTimeseries) Unpack(tbf *tmpBlocksFile, dst *Result, tr storage.TimeRange, fetchData bool, at *auth.Token) error {