From 1c34cc33e5417dc8dfb669433c629930204ab24a 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 0ef77ddf59..aff7c4dc5a 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -170,8 +170,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