Skip to content

Commit fc6052b

Browse files
authored
Merge pull request #2315 from k8s-infra-cherrypick-robot/cherry-pick-2314-to-release-1.31
[release-1.31] chore: set GoMaxProcs as 2
2 parents 36e1f99 + 19a51f0 commit fc6052b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/azurefile/azurefile_options.go

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type DriverOptions struct {
4848
PrintVolumeStatsCallLogs bool
4949
SasTokenExpirationMinutes int
5050
WaitForAzCopyTimeoutMinutes int
51+
GoMaxProcs int
5152
KubeConfig string
5253
Endpoint string
5354
}
@@ -87,6 +88,7 @@ func (o *DriverOptions) AddFlags() *flag.FlagSet {
8788
fs.IntVar(&o.WaitForAzCopyTimeoutMinutes, "wait-for-azcopy-timeout-minutes", 19, "timeout in minutes for waiting for azcopy to finish")
8889
fs.StringVar(&o.KubeConfig, "kubeconfig", "", "Absolute path to the kubeconfig file. Required only when running out of cluster.")
8990
fs.StringVar(&o.Endpoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint")
91+
fs.IntVar(&o.GoMaxProcs, "max-procs", 2, "maximum number of CPUs that can be executing simultaneously in golang runtime")
9092

9193
return fs
9294
}

pkg/azurefileplugin/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"net"
2424
"net/http"
2525
"os"
26+
"runtime"
2627
"strings"
2728

2829
"sigs.k8s.io/azurefile-csi-driver/pkg/azurefile"
@@ -61,6 +62,9 @@ func main() {
6162
}
6263

6364
func handle() {
65+
runtime.GOMAXPROCS(driverOptions.GoMaxProcs)
66+
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))
67+
6468
driver := azurefile.NewDriver(&driverOptions)
6569
if driver == nil {
6670
klog.Fatalln("Failed to initialize azurefile CSI Driver")

0 commit comments

Comments
 (0)