cmd/containerd-shim: set GOMAXPROCS to 2
The shim doesn't need massive concurrency and a bunch of CPUs to do its job correctly. We can reduce the number of threads to save memory at little cost to performance. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
8e09b565a7
commit
5764bf1bad
@ -60,6 +60,13 @@ func main() {
|
|||||||
if debugFlag {
|
if debugFlag {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("GOMAXPROCS") == "" {
|
||||||
|
// If GOMAXPROCS hasn't been set, we default to a value of 2 to reduce
|
||||||
|
// the number of Go stacks present in the shim.
|
||||||
|
runtime.GOMAXPROCS(2)
|
||||||
|
}
|
||||||
|
|
||||||
if err := executeShim(); err != nil {
|
if err := executeShim(); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "containerd-shim: %s\n", err)
|
fmt.Fprintf(os.Stderr, "containerd-shim: %s\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user