tysonnorris commented on a change in pull request #2689: WIP on dynamic invoker 
id assignment
URL: 
https://github.com/apache/incubator-openwhisk/pull/2689#discussion_r136706298
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/loadBalancer/InvokerSupervision.scala
 ##########
 @@ -332,3 +332,51 @@ object InvokerActor {
 
     val timerName = "testActionTimer"
 }
+
+/*
+ * Actor to handle invoker registration
+ */
+class Registrar (
+    sendIdToInvoker: (InvokerIdResponseMessage) => Future[RecordMetadata],
+    registerConsumer: MessageConsumer) extends Actor {
+
+    implicit val transid = TransactionId.registrar
+    implicit val logging = new AkkaLogging(context.system.log)
+    implicit val timeout = Timeout(5.seconds)
+    implicit val ec = context.dispatcher
+
+    // State of the actor. It's important not to close over these
+    // references directly, so they don't escape the Actor.
+    var nextInvokerId = 0
+
+    def receive = {
+      case m : InvokerIdRequestMessage => {
+        val response = InvokerIdResponseMessage(m.uuid, nextInvokerId)
+        nextInvokerId += 1
+        sendIdToInvoker(response)
 
 Review comment:
   This (sending an ID back to invoker) is only required because invoker id is 
currently an Int, and the registration was using UUID, right? Maybe we can 
change it to a String to be more flexible (@dragos and I just talked about this 
for other reasons as well). Then there is no need to explicitly send it an ID, 
AND maybe it can default to the host ip (and override with an "advertise ip" 
config).  This enforces the idea of "1 invoker per host" - not sure that breaks 
anything for kube.  
   
   Side note: the case we ran into was where our invoker was misconfigured and 
kept restarting with a different ID each restart; eventually this crashed the 
*controller* because of the volume of health topic messages that were processed 
into a Map during controller startup, so separately it will be good to set the 
health topic consumer to receive only the latest n health messages. I'll log an 
issue for 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:
[email protected]


With regards,
Apache Git Services

Reply via email to