Skip to content

Commit 819cd2d

Browse files
authored
Merge pull request #1022 from mattcary/maxproc-backport
Backport maxprocs (#969)
2 parents 3c818dc + 4ba1ad7 commit 819cd2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/gce-pd-csi-driver/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"flag"
2121
"math/rand"
2222
"os"
23+
"runtime"
2324
"time"
2425

2526
"k8s.io/klog"
@@ -40,7 +41,10 @@ var (
4041
httpEndpoint = flag.String("http-endpoint", "", "The TCP network address where the prometheus metrics endpoint will listen (example: `:8080`). The default is empty string, which means metrics endpoint is disabled.")
4142
metricsPath = flag.String("metrics-path", "/metrics", "The HTTP path where prometheus metrics will be exposed. Default is `/metrics`.")
4243
extraVolumeLabelsStr = flag.String("extra-labels", "", "Extra labels to attach to each PD created. It is a comma separated list of key value pairs like '<key1>=<value1>,<key2>=<value2>'. See https://cloud.google.com/compute/docs/labeling-resources for details")
43-
version string
44+
45+
maxprocs = flag.Int("maxprocs", 1, "GOMAXPROCS override")
46+
47+
version string
4448
)
4549

4650
const (
@@ -67,6 +71,9 @@ func main() {
6771
func handle() {
6872
var err error
6973

74+
runtime.GOMAXPROCS(*maxprocs)
75+
klog.Infof("Sys info: NumCPU: %v MAXPROC: %v", runtime.NumCPU(), runtime.GOMAXPROCS(0))
76+
7077
if version == "" {
7178
klog.Fatalf("version must be set at compile time")
7279
}

0 commit comments

Comments
 (0)