quintenp01 commented on code in PR #5443:
URL: https://github.com/apache/openwhisk/pull/5443#discussion_r1337882263


##########
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:
   Ah, I was looking at the invoker application.conf. So yeah with those 
settings 0.125 core is correct.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to