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.
This commit is contained in:
Aliaksandr Valialkin 2024-02-05 12:11:04 +02:00
parent fce313ae7f
commit de9a9546c2
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 0 additions and 15 deletions

View file

@ -11,7 +11,6 @@ import (
"github.com/VictoriaMetrics/VictoriaMetrics/app/vlselect" "github.com/VictoriaMetrics/VictoriaMetrics/app/vlselect"
"github.com/VictoriaMetrics/VictoriaMetrics/app/vlstorage" "github.com/VictoriaMetrics/VictoriaMetrics/app/vlstorage"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo" "github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/cgroup"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/envflag" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envflag"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/fs" "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 . "+ 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 . "+ "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") "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() { func main() {
@ -34,7 +32,6 @@ func main() {
flag.CommandLine.SetOutput(os.Stdout) flag.CommandLine.SetOutput(os.Stdout)
flag.Usage = usage flag.Usage = usage
envflag.Parse() envflag.Parse()
cgroup.SetGOGC(*gogc)
buildinfo.Init() buildinfo.Init()
logger.Init() logger.Init()

View file

@ -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 var gogc int
// GetMemoryLimit returns cgroup memory limit // GetMemoryLimit returns cgroup memory limit