rabbah commented on a change in pull request #2360: Choose target invoker based
on specific invoker load.
URL:
https://github.com/apache/incubator-openwhisk/pull/2360#discussion_r122859641
##########
File path:
core/controller/src/main/scala/whisk/core/loadBalancer/LoadBalancerService.scala
##########
@@ -332,29 +299,84 @@ class LoadBalancerService(config: WhiskConfig,
entityStore: EntityStore)(implici
private def hashSubjectAction(msg: ActivationMessage): Int = {
val subject = msg.user.subject.asString
val path = msg.action.toString
- subject.hashCode() ^ path.hashCode()
+ (subject.hashCode() ^ path.hashCode()).abs
}
+}
+
+object LoadBalancerService {
+ def requiredProperties = kafkaHost ++ consulServer ++
+ Map(loadbalancerActivationCountBeforeNextInvoker -> null,
+ loadbalancerInvokerBusyThreshold -> null)
/** Memoizes the result of `f` for later use. */
- private def memoize[I, O](f: I => O): I => O = new
scala.collection.mutable.HashMap[I, O]() {
+ def memoize[I, O](f: I => O): I => O = new
scala.collection.mutable.HashMap[I, O]() {
override def apply(key: I) = getOrElseUpdate(key, f(key))
}
/** All prime coprime numbers until x including 1. Result is memoized. */
- private val coprimePrimeNumbersUntil: Int => IndexedSeq[Int] = memoize {
+ val coprimePrimeNumbersUntil: Int => IndexedSeq[Int] =
LoadBalancerService.memoize {
case x =>
1 +: (1 to x).foldLeft(IndexedSeq.empty[Int])((primes, cur) => {
if (x % cur != 0 && !primes.exists(cur % _ == 0)) {
primes :+ cur
} else primes
})
}
-}
-object LoadBalancerService {
- def requiredProperties = kafkaHost ++ consulServer ++
- Map(loadbalancerActivationCountBeforeNextInvoker -> null,
- loadbalancerInvokerBusyThreshold -> null)
+ /**
+ * Scans through all invokers and searches for an invoker, that has a
queue is
Review comment:
that has a queue is below -> that has a queue length below
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services