From f47e26025c7f10953fef80b66e5c5b529ddc0b21 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 25 Mar 2023 16:36:45 -0700 Subject: [PATCH] app/vmselect/netstorage: document why runtime.Gosched() is removed at 28f054bb006a139ebd003e087d26aae72b1fa829 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3966 --- app/vmselect/netstorage/netstorage.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index aff7c4dc5..6d414e38c 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -170,6 +170,11 @@ func timeseriesWorker(qt *querytracer.Tracer, workChs []chan *timeseriesWork, wo idx := (i + workerID) % uint(len(workChs)) ch := workChs[idx] for len(ch) > 0 { + // Do not call runtime.Gosched() here in order to give a chance + // the real owner of the work to complete it, since it consumes additional CPU + // and slows down the code on systems with big number of CPU cores. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3966#issuecomment-1483208419 + // It is expected that every channel in the workChs is already closed, // so the next line should return immediately. tsw, ok := <-ch