cbickel commented on a change in pull request #4011: Customize invoker use
memory for memory based loadbalancing
URL:
https://github.com/apache/incubator-openwhisk/pull/4011#discussion_r218740795
##########
File path:
core/controller/src/main/scala/whisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
##########
@@ -570,8 +567,16 @@ case class ShardingContainerPoolBalancerState(
if (oldSize < newSize) {
// Keeps the existing state..
+ var index = oldSize - 1
_invokerSlots = _invokerSlots ++ IndexedSeq.fill(newSize - oldSize) {
- new ForcibleSemaphore(currentInvokerThreshold.toMB.toInt)
Review comment:
What about the following approach:
you take the list `_invokers` and drop the first `_invokerSlots.length`
elements. Than you map through the invokers (you will have the memory
available) and return a list of new Semaphores. Last, you add it to the current
list of `_invokerSlots`.
```scala
_invokerSlots = _invokerSlots ++ _invokers.drop(_invokerSlots.length).map {
i =>
val userMemoryOfThisInvoker = i.id.userMemory
...
new ForcibleSemaphore(calculatedMemory)
}
```
----------------------------------------------------------------
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