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/02/11 09:55:46 UTC

[GitHub] ningyougang commented on a change in pull request #3272: improve loadbalancer's schedule algorithm

ningyougang commented on a change in pull request #3272: improve loadbalancer's schedule algorithm
URL: https://github.com/apache/incubator-openwhisk/pull/3272#discussion_r167428428
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
 ##########
 @@ -345,7 +345,8 @@ object ContainerPoolBalancer extends LoadBalancerProvider {
         .find(_._3 < invokerBusyThreshold)
         .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 2))
         .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 3))
-        .orElse(invokerProgression.headOption)
+        .orElse(
+          if (invokerProgression.size == 0) None else invokerProgression.lift(Random.nextInt(invokerProgression.size)))
 
 Review comment:
   `invokerProgression` here,  doesn't have `nonEmpty` method.

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