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/11/28 10:33:26 UTC

[GitHub] markusthoemmes commented on a change in pull request #4137: Remove busy loop in case the invoker is overloaded.

markusthoemmes commented on a change in pull request #4137: Remove busy loop in case the invoker is overloaded.
URL: https://github.com/apache/incubator-openwhisk/pull/4137#discussion_r237025725
 
 

 ##########
 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala
 ##########
 @@ -99,13 +99,16 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
     // their requests and send them back to the pool for rescheduling (this may happen if "docker" operations
     // fail for example, or a container has aged and was destroying itself when a new request was assigned)
     case r: Run =>
-      // Check if the message is resent from the buffer. Only the first message on the buffer can be resent.
-      val isResentFromBuffer = runBuffer.nonEmpty && runBuffer.dequeueOption.exists(_._1.msg == r.msg)
+      // Checks if the current message is the first in the queue
+      val isFirstInQueue = runBuffer.dequeueOption.exists(_._1.msg == r.msg)
+      // A resend is only valid, if the message is the first one in the queue. Otherwise it is a result of a race condition.
+      val isValidResent = r.fromQueue && isFirstInQueue
 
 Review comment:
   Since you already switched to using a `runFirstMessageOfQueue` method, can we simplify our logic towards this:
   
   1. On getting a run message, we always append to the buffer
   2. After appending, we'll run the `runFirstMessageOfQueue` method
   
   I imagine that that way, we don't need the `isFirstInQueue` and `isValidResent` checks, as that guarantees that we always send messages off of a queue.
   
   (The `Run` handler could of course optimize, and bypass the queue if it knows it's empty)
   
   WDYT?

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