Merge pull request #3917 from jaininshah9/master
changing the formula to correctly pass the CPUQota to docker
This commit is contained in:
commit
557a70f78d
|
@ -1138,9 +1138,13 @@ func (d *DockerDriver) createContainerConfig(ctx *ExecContext, task *structs.Tas
|
|||
}
|
||||
|
||||
// Calculate CPU Quota
|
||||
// cfs_quota_us is the time per core, so we must
|
||||
// multiply the time by the number of cores available
|
||||
// See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/resource_management_guide/sec-cpu
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue