From a64fd0c47c1c853ec8d522bb6441f06c8139e28b Mon Sep 17 00:00:00 2001 From: Jainin Shah Date: Tue, 27 Feb 2018 12:32:23 -0800 Subject: [PATCH] changing the formula to correctly pass the CPUQota to docker --- client/driver/docker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 9851fa40a..c0133b068 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -1139,8 +1139,9 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas // Calculate CPU Quota if driverConfig.CPUHardLimit { + numCores := runtime.NumCPU() percentTicks := float64(task.Resources.CPU) / float64(d.node.Resources.CPU) - hostConfig.CPUQuota = int64(percentTicks * defaultCFSPeriodUS) + hostConfig.CPUQuota = int64(percentTicks*defaultCFSPeriodUS) * int64(numCores) } // Windows does not support MemorySwap/MemorySwappiness #2193