You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/03/12 05:07:44 UTC

[GitHub] [openwhisk] chetanmeh commented on a change in pull request #4814: Kcf - optional cpu resource scaling based on action memory

chetanmeh commented on a change in pull request #4814: Kcf - optional cpu resource scaling based on action memory
URL: https://github.com/apache/openwhisk/pull/4814#discussion_r391403702
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/kubernetes/WhiskPodBuilder.scala
 ##########
 @@ -113,6 +121,13 @@ class WhiskPodBuilder(client: NamespacedKubernetesClient,
     pod
   }
 
+  def calculateCpu(c: KubernetesCpuScalingConfig, memory: ByteSize): Int = {
+    val cpuPerMemorySegment = c.millicpus
+    val cpuMin = c.millicpus
+    val cpuMax = c.maxMillicpus
+    math.min(math.max((memory.toMB / c.memory.toMB) * cpuPerMemorySegment, cpuMin), cpuMax).toInt
 
 Review comment:
   @tysonnorris Just checking if we should be casting to `double` here as its an integer based division

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services