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 2019/05/13 05:30:10 UTC

[GitHub] [incubator-openwhisk] style95 commented on a change in pull request #4477: Limit the minimum to the cpu-share value

style95 commented on a change in pull request #4477: Limit the minimum to the cpu-share value
URL: https://github.com/apache/incubator-openwhisk/pull/4477#discussion_r283191376
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerFactory.scala
 ##########
 @@ -44,7 +44,10 @@ case class ContainerPoolConfig(userMemory: ByteSize, concurrentPeekFactor: Doubl
    */
   private val totalShare = 1024.0 // This is a pre-defined value coming from docker and not our hard-coded value.
   // Grant more CPU to a container if it allocates more memory.
-  def cpuShare(reservedMemory: ByteSize) = (totalShare / (userMemory.toBytes / reservedMemory.toBytes)).toInt
+  def cpuShare(reservedMemory: ByteSize) = {
+    val cpuShare = (totalShare / (userMemory.toBytes / reservedMemory.toBytes)).toInt
 
 Review comment:
   @KeonHee Thank you for the contribution.
   How about using `max`?
   Then we may be able to something like this:
   
   ```
   val cpuShare = max((totalShare / (userMemory.toBytes / reservedMemory.toBytes)).toInt, 2)
   ```

----------------------------------------------------------------
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