From f222cf9200f5704ad88208dc5b3e5dcc48223ece Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 5 Feb 2024 12:11:04 +0200 Subject: [PATCH] lib/cgroup: remove SetGOGC() function GOGC can be already set via environment variable. There is no need in adding new approaches for setting the GOGC (such as command-line flag), since they complicate operations. --- app/victoria-logs/main.go | 3 --- lib/cgroup/mem.go | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/app/victoria-logs/main.go b/app/victoria-logs/main.go index 1a3aea2a9..0a56dd91f 100644 --- a/app/victoria-logs/main.go +++ b/app/victoria-logs/main.go @@ -11,7 +11,6 @@ import ( "github.com/VictoriaMetrics/VictoriaMetrics/app/vlselect" "github.com/VictoriaMetrics/VictoriaMetrics/app/vlstorage" "github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/cgroup" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envflag" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/fs" @@ -26,7 +25,6 @@ var ( useProxyProtocol = flag.Bool("httpListenAddr.useProxyProtocol", false, "Whether to use proxy protocol for connections accepted at -httpListenAddr . "+ "See https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt . "+ "With enabled proxy protocol http server cannot serve regular /metrics endpoint. Use -pushmetrics.url for metrics pushing") - gogc = flag.Int("gogc", 100, "GOGC to use. See https://tip.golang.org/doc/gc-guide") ) func main() { @@ -34,7 +32,6 @@ func main() { flag.CommandLine.SetOutput(os.Stdout) flag.Usage = usage envflag.Parse() - cgroup.SetGOGC(*gogc) buildinfo.Init() logger.Init() diff --git a/lib/cgroup/mem.go b/lib/cgroup/mem.go index 93c127f08..f35d3cbad 100644 --- a/lib/cgroup/mem.go +++ b/lib/cgroup/mem.go @@ -34,18 +34,6 @@ func initGOGC() { } } -// SetGOGC sets GOGC to the given percent -func SetGOGC(percent int) { - if percent <= 0 { - return - } - if percent > 100 { - percent = 100 - } - gogc = percent - debug.SetGCPercent(gogc) -} - var gogc int // GetMemoryLimit returns cgroup memory limit