From 28f054bb006a139ebd003e087d26aae72b1fa829 Mon Sep 17 00:00:00 2001 From: Zakhar Bessarab Date: Fri, 24 Mar 2023 16:15:13 +0300 Subject: [PATCH] vmselect/netstorage: remove direct calls to `Gosched` to reduce amount of locks for global scope using `runtime.Gosched` requires acquiring global lock to check if there are any other goroutines to perform tasks. with the latest versions of runtime it can pause running goroutines automatically without requiring to call `Gosched` directly. Updates #3966 Signed-off-by: Zakhar Bessarab --- app/vmselect/netstorage/netstorage.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 4fb850379..a5f5de8e2 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -152,8 +152,6 @@ func timeseriesWorker(qt *querytracer.Tracer, workChs []chan *timeseriesWork, wo idx := (i + workerID) % uint(len(workChs)) ch := workChs[idx] for len(ch) > 0 { - // Give a chance other goroutines to perform their work. - runtime.Gosched() // It is expected that every channel in the workChs is already closed, // so the next line should return immediately. tsw, ok := <-ch