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


With regards,
Apache Git Services

Reply via email to