You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/06/06 12:43:16 UTC

[GitHub] markusthoemmes commented on a change in pull request #2205: Add ability to deploy a "hot-standby" controller

markusthoemmes commented on a change in pull request #2205: Add ability to deploy a "hot-standby" controller
URL: https://github.com/apache/incubator-openwhisk/pull/2205#discussion_r120347367
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/entitlement/ActivationThrottler.scala
 ##########
 @@ -53,34 +50,27 @@ class ActivationThrottler(consulServer: String, loadBalancer: LoadBalancer, conc
     private var userActivationCounter = Map.empty[String, Int]
 
     private val healthCheckInterval = 5.seconds
-    private val consul = new ConsulClient(consulServer)
 
     /**
      * Checks whether the operation should be allowed to proceed.
      */
-    def check(subject: Subject): Boolean = userActivationCounter.getOrElse(subject.asString, 0) < concurrencyLimit
+    def check(subject: Subject)(implicit tid: TransactionId): Boolean = {
+        val concurrentActivations = userActivationCounter.getOrElse(subject.asString, 0)
+        logging.info(this, s"subject = ${subject.toString}, concurrent activations = $concurrentActivations, below limit = $concurrencyLimit")
+        concurrentActivations < concurrencyLimit
+    }
 
     /**
      * Checks whether the system is in a generally overloaded state.
      */
-    def isOverloaded = userActivationCounter.values.sum > systemOverloadLimit
-
-    /**
-     * Publish into Consul KV values showing the controller's view
-     * of concurrent activations on a per-user basis.
-     */
-    private def publishUserConcurrentActivation() = {
-        // Any sort of partitioning will be ok for monitoring
-        Future.sequence(userActivationCounter.groupBy(_._1.take(1)).map {
-            case (prefix, items) =>
-                val key = ControllerKeys.userActivationCountKey + "/" + prefix
-                consul.kv.put(key, items.toJson.compactPrint)
-        })
+    def isOverloaded()(implicit tid: TransactionId): Boolean = {
+        val concurrentActivations = userActivationCounter.values.sum
+        logging.info(this, s"concurrent activations in system = $concurrentActivations, below limit = $systemOverloadLimit")
+        concurrentActivations > systemOverloadLimit
     }
 
     Scheduler.scheduleWaitAtLeast(healthCheckInterval) { () =>
         userActivationCounter = loadBalancer.getActiveUserActivationCounts
-        publishUserConcurrentActivation()
+        Future.successful(true)
 
 Review comment:
   `Future.successful(())` (`Unit`) should suffice here.
 
----------------------------------------------------------------
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