mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows: Use system specific parallelism value on containers restart
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
(cherry picked from commit 447a840254
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ea84732a77
commit
e1cae011e2
1 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,9 @@ package daemon // import "github.com/docker/docker/daemon"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim"
|
"github.com/Microsoft/hcsshim"
|
||||||
|
@ -40,9 +42,10 @@ const (
|
||||||
windowsMaxCPUPercent = 100
|
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 {
|
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.
|
// Windows has no concept of an execution state directory. So use config.Root here.
|
||||||
|
|
Loading…
Reference in a new issue