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 2018/06/20 02:16:39 UTC

[GitHub] jiangpengcheng commented on issue #3656: Adjust the ForcableSemaphore mechanism

jiangpengcheng commented on issue #3656: Adjust the ForcableSemaphore mechanism 
URL: https://github.com/apache/incubator-openwhisk/pull/3656#issuecomment-398602587
 
 
   @rabbah, yes, I set the `currentInvokerThreshold` as the hard max, so the total slots for an invoker won't exceeded that value, normally this won't happen, but when the number of controllers is changed, things are different.
   
   let's say we have 4 as the number of slot for each invoker, and there are 2 running actions in invokerN, then the controller cluster changed, and the `currentInvokerThreshold` is changed to 8, the `invokerSlots` will be recreated:
   
   ```
   def updateCluster(newSize: Int): Unit = {
     val actualSize = newSize max 1 // if a cluster size < 1 is reported, falls back to a size of 1 (alone)
     if (_clusterSize != actualSize) {
       _clusterSize = actualSize
       val newTreshold = (totalInvokerThreshold / actualSize) max 1 // letting this fall below 1 doesn't make sense
       currentInvokerThreshold = newTreshold
       _invokerSlots = _invokerSlots.map(_ => new ForcableSemaphore(currentInvokerThreshold))
   
       logging.info(
         this,
         s"loadbalancer cluster size changed to $actualSize active nodes. invokerThreshold = $currentInvokerThreshold")(
         TransactionId.loadbalancer)
     }
   }
   ```
   
   so there are 8 free slots for invokerN
   
   but there are still two running actions in invokerN, after they are finished, they will release the 2 slots they occupied before, then the number of free slot for invokerN will be changed to 10, which exceeded the `currentInvokerThreshold`, so I set a hard max value to prevent this.
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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