Skip to content

Commit

Permalink
Merge pull request #2792 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2789-to-release-1.31

[release-1.31] chore: set GoMaxProcs as 2
  • Loading branch information
andyzhangx authored Jan 4, 2025
2 parents 36f1c75 + 13440d5 commit 544994c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/azuredisk/azuredisk_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type DriverOptions struct {
RemoveNotReadyTaint bool
MaxConcurrentFormat int64
ConcurrentFormatTimeout int64
GoMaxProcs int64
}

func (o *DriverOptions) AddFlags() *flag.FlagSet {
Expand Down Expand Up @@ -109,6 +110,6 @@ func (o *DriverOptions) AddFlags() *flag.FlagSet {
fs.StringVar(&o.Endpoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint")
fs.Int64Var(&o.MaxConcurrentFormat, "max-concurrent-format", 2, "maximum number of concurrent format exec calls")
fs.Int64Var(&o.ConcurrentFormatTimeout, "concurrent-format-timeout", 300, "maximum time in seconds duration of a format operation before its concurrency token is released")

fs.Int64Var(&o.GoMaxProcs, "max-procs", 2, "maximum number of CPUs that can be executing simultaneously in golang runtime")
return fs
}
4 changes: 4 additions & 0 deletions pkg/azurediskplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net"
"net/http"
"os"
"runtime"
"strings"

"k8s.io/component-base/metrics/legacyregistry"
Expand Down Expand Up @@ -60,6 +61,9 @@ func main() {
}

func handle() {
runtime.GOMAXPROCS(int(driverOptions.GoMaxProcs))
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))

driver := azuredisk.NewDriver(&driverOptions)
if driver == nil {
klog.Fatalln("Failed to initialize azuredisk CSI Driver")
Expand Down

0 comments on commit 544994c

Please sign in to comment.