openwhisk-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [incubator-openwhisk] ddragosd commented on a change in pull request #4326: Invoker backpressure
Date Tue, 19 Mar 2019 00:18:30 GMT
ddragosd commented on a change in pull request #4326: Invoker backpressure

 File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/AkkaClusterContainerResourceManager.scala
 @@ -0,0 +1,376 @@
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openwhisk.core.containerpool
+import akka.Done
+import akka.cluster.Cluster
+import akka.cluster.ddata.DistributedData
+import akka.cluster.ddata.LWWRegister
+import akka.cluster.ddata.LWWRegisterKey
+import akka.cluster.ddata.ORSet
+import akka.cluster.ddata.ORSetKey
+import akka.cluster.ddata.Replicator.Changed
+import akka.cluster.ddata.Replicator.Subscribe
+import akka.cluster.ddata.Replicator.Unsubscribe
+import akka.cluster.ddata.Replicator.Update
+import akka.cluster.ddata.Replicator.UpdateFailure
+import akka.cluster.ddata.Replicator.UpdateSuccess
+import akka.cluster.ddata.Replicator.WriteLocal
+import akka.cluster.pubsub.DistributedPubSub
+import akka.cluster.pubsub.DistributedPubSubMediator.Put
+import akka.cluster.pubsub.DistributedPubSubMediator.Send
+import java.time.Instant
+import org.apache.openwhisk.common.Logging
+import org.apache.openwhisk.core.entity.ByteSize
+import org.apache.openwhisk.core.entity.InvokerInstanceId
+import org.apache.openwhisk.core.entity.size._
+import org.apache.openwhisk.utils.NodeStats
+import org.apache.openwhisk.utils.NodeStatsUpdate
+import scala.collection.immutable
+import scala.collection.mutable.ListBuffer
+import scala.concurrent.Future
+import scala.concurrent.duration._
+import scala.util.Try
+class AkkaClusterContainerResourceManager(system: ActorSystem,
+                                          instanceId: InvokerInstanceId,
+                                          poolActor: ActorRef,
+                                          poolConfig: ContainerPoolConfig)(implicit logging:
+    extends ContainerResourceManager {
+  /** cluster state tracking */
+  private var localReservations: Map[ActorRef, Reservation] = Map.empty //this pool's own
+  private var remoteReservations: Map[Int, List[Reservation]] = Map.empty //other pool's
+  private var localUnused: Map[ActorRef, ContainerData] = Map.empty // this pool's unused
+  private var remoteUnused
+    : Map[Int, List[RemoteContainerRef]] = Map.empty //invoker akka address -> List[RemoteContainerRef]
+  var clusterActionHostStats = Map.empty[String, NodeStats] //track the most recent node
stats per action host (host that is able to run action containers)
+  var clusterActionHostsCount = 0
+  var prewarmsInitialized = false
+  val clusterPoolData: ActorRef =
+    system.actorOf(
+      Props(new ContainerPoolClusterData(instanceId, poolActor)),
+      ContainerPoolClusterData.clusterPoolActorName(instanceId.toInt))
+  //invoker keys
+  val InvokerIdsKey = ORSetKey[Int]("invokerIds")
+  //my keys
+  val myId = instanceId.toInt
+  val myReservationsKey = LWWRegisterKey[List[Reservation]]("reservation" + myId)
 Review comment:
   > CRDTs of type last-write-wins (LWWMap, LWWRegister) use clock time to figure out how
to merge concurrent changes. Whilst this can be quite useful it also means that you need to
have synchronized clocks accross all nodes, which can be tricky to achieve in practice (to
put it mildly)
   Any concerns with this suggestion ?

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message