From e1cae011e2d83ab0c0bbcddf0c59ef6d8b6f6e42 Mon Sep 17 00:00:00 2001 From: Olli Janatuinen Date: Tue, 13 Aug 2019 10:10:19 +0300 Subject: [PATCH] Windows: Use system specific parallelism value on containers restart Signed-off-by: Olli Janatuinen (cherry picked from commit 447a840254410df3b9345c652b601f08447b8467) Signed-off-by: Sebastiaan van Stijn --- daemon/daemon_windows.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index f6d0f8c6ce..495f7788cb 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -3,7 +3,9 @@ package daemon // import "github.com/docker/docker/daemon" import ( "context" "fmt" + "math" "path/filepath" + "runtime" "strings" "github.com/Microsoft/hcsshim" @@ -40,9 +42,10 @@ const ( windowsMaxCPUPercent = 100 ) -// Windows doesn't really have rlimits. +// Windows containers are much larger than Linux containers and each of them +// have > 20 system processes which why we use much smaller parallelism value. func adjustParallelLimit(n int, limit int) int { - return limit + return int(math.Max(1, math.Floor(float64(runtime.NumCPU())*.8))) } // Windows has no concept of an execution state directory. So use config.Root here.