quintenp01 commented on code in PR #5443: URL: https://github.com/apache/openwhisk/pull/5443#discussion_r1337870081
########## common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerFactory.scala: ########## @@ -73,6 +75,15 @@ case class ContainerPoolConfig(userMemory: ByteSize, // Grant more CPU to a container if it allocates more memory. def cpuShare(reservedMemory: ByteSize) = max((totalShare / (userMemory.toBytes / reservedMemory.toBytes)).toInt, 2) // The minimum allowed cpu-shares is 2 + + private val minContainerCpus = 0.01 // The minimum cpus allowed by docker is 0.01 + def cpuLimit(reservedMemory: ByteSize): Option[Double] = { + userCpus.map(c => { + val containerCpus = c / (userMemory.toBytes / reservedMemory.toBytes) + val roundedContainerCpus = round(containerCpus * 100).toDouble / 100 // Docker only allows decimal precision of 2 + max(roundedContainerCpus, minContainerCpus) Review Comment: It depends on how many total cores are configured. Looks like the default userMemory is 1024MB, so with 1 total core configured the limit would be 0.25 cores for 256MB. With 2 cores configured, the limit would be 0.5 cores for 256MB. I left the total cores not configured by default though so no limit is applied unless that is set. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@openwhisk.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org