You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by sl...@apache.org on 2019/10/24 14:37:54 UTC

[openwhisk] branch master updated: Make the formula to calculate the action time limit more configurable (#4700)

This is an automated email from the ASF dual-hosted git repository.

slange pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a7bb7c  Make the formula to calculate the action time limit more configurable (#4700)
8a7bb7c is described below

commit 8a7bb7c278a0568d17457548a820bba6cb60f795
Author: Steffen Rost <sr...@de.ibm.com>
AuthorDate: Thu Oct 24 16:37:39 2019 +0200

    Make the formula to calculate the action time limit more configurable (#4700)
    
    Introduce configurable extra time parameter that is added to the configurable multiple of max(action timeout, standard action timeout).
---
 ansible/group_vars/all                                            | 1 +
 ansible/roles/controller/tasks/deploy.yml                         | 2 ++
 core/controller/src/main/resources/reference.conf                 | 5 ++++-
 .../apache/openwhisk/core/loadBalancer/CommonLoadBalancer.scala   | 4 ++--
 .../core/loadBalancer/ShardingContainerPoolBalancer.scala         | 8 ++++++--
 .../loadBalancer/test/ShardingContainerPoolBalancerTests.scala    | 6 +++++-
 6 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index 3c4d197..fd039c6 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -90,6 +90,7 @@ controller:
   managedFraction: "{{ controller_managed_fraction | default(1.0 - (controller_blackbox_fraction | default(__controller_blackbox_fraction))) }}"
   blackboxFraction: "{{ controller_blackbox_fraction | default(__controller_blackbox_fraction) }}"
   timeoutFactor: "{{ controller_timeout_factor | default(2) }}"
+  timeoutAddon: "{{ controller_timeout_addon | default('1 m') }}"
   instances: "{{ groups['controllers'] | length }}"
   akka:
     provider: cluster
diff --git a/ansible/roles/controller/tasks/deploy.yml b/ansible/roles/controller/tasks/deploy.yml
index 4a7482e..a955c47 100644
--- a/ansible/roles/controller/tasks/deploy.yml
+++ b/ansible/roles/controller/tasks/deploy.yml
@@ -253,6 +253,8 @@
         "{{ controller.blackboxFraction }}"
       "CONFIG_whisk_loadbalancer_timeoutFactor":
         "{{ controller.timeoutFactor }}"
+      "CONFIG_whisk_loadbalancer_timeoutAddon":
+        "{{ controller.timeoutAddon }}"
 
       "CONFIG_kamon_statsd_hostname": "{{ metrics.kamon.host }}"
       "CONFIG_kamon_statsd_port": "{{ metrics.kamon.port }}"
diff --git a/core/controller/src/main/resources/reference.conf b/core/controller/src/main/resources/reference.conf
index 55322de..a33cb44 100644
--- a/core/controller/src/main/resources/reference.conf
+++ b/core/controller/src/main/resources/reference.conf
@@ -23,9 +23,12 @@ whisk {
     managed-fraction: 90%
     blackbox-fraction: 10%
     # factor to increase the timeout for forced active acks
-    # timeout = time-limit.std * timeoutfactor + 1m
+    # timeout = time-limit.std * timeout-factor + timeout-addon
     # default is 2 because init and run can both use the configured timeout fully
     timeout-factor = 2
+    # extra time to increase the timeout for forced active acks
+    # default is 1.minute
+    timeout-addon = 1m
   }
   controller {
     protocol: http
diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/CommonLoadBalancer.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/CommonLoadBalancer.scala
index 2f6652e..8182f83 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/CommonLoadBalancer.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/CommonLoadBalancer.scala
@@ -94,13 +94,13 @@ abstract class CommonLoadBalancer(config: WhiskConfig,
    * on invoker behavior that a cold invocation's init duration may be as long as its run duration. Higher factors
    * may account for additional wait times.
    *
-   * Finally, a constant duration is added to the diluted timeout to be lenient towards general delays / wait times.
+   * Finally, a configurable duration is added to the diluted timeout to be lenient towards general delays / wait times.
    *
    * @param actionTimeLimit the action's time limit
    * @return the calculated time duration within which a completion ack must be received
    */
   private def calculateCompletionAckTimeout(actionTimeLimit: FiniteDuration): FiniteDuration = {
-    (actionTimeLimit.max(TimeLimit.STD_DURATION) * lbConfig.timeoutFactor) + 1.minute
+    (actionTimeLimit.max(TimeLimit.STD_DURATION) * lbConfig.timeoutFactor) + lbConfig.timeoutAddon
   }
 
   /**
diff --git a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/ShardingContainerPoolBalancer.scala b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
index d03081d..e9e193f 100644
--- a/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
+++ b/core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
@@ -594,9 +594,13 @@ case class ClusterConfig(useClusterBootstrap: Boolean)
  * Configuration for the sharding container pool balancer.
  *
  * @param blackboxFraction the fraction of all invokers to use exclusively for blackboxes
- * @param timeoutFactor factor to influence the timeout period for forced active acks (time-limit.std * timeoutFactor + 1m)
+ * @param timeoutFactor factor to influence the timeout period for forced active acks (time-limit.std * timeoutFactor + timeoutAddon)
+ * @param timeoutAddon extra time to influence the timeout period for forced active acks (time-limit.std * timeoutFactor + timeoutAddon)
  */
-case class ShardingContainerPoolBalancerConfig(managedFraction: Double, blackboxFraction: Double, timeoutFactor: Int)
+case class ShardingContainerPoolBalancerConfig(managedFraction: Double,
+                                               blackboxFraction: Double,
+                                               timeoutFactor: Int,
+                                               timeoutAddon: FiniteDuration)
 
 /**
  * State kept for each activation slot until completion.
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
index 7dee5ad..031e51a 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
@@ -96,7 +96,11 @@ class ShardingContainerPoolBalancerTests
     IndexedSeq.fill(count)(new NestedSemaphore[FullyQualifiedEntityName](max))
 
   def lbConfig(blackboxFraction: Double, managedFraction: Option[Double] = None) =
-    ShardingContainerPoolBalancerConfig(managedFraction.getOrElse(1.0 - blackboxFraction), blackboxFraction, 1)
+    ShardingContainerPoolBalancerConfig(
+      managedFraction.getOrElse(1.0 - blackboxFraction),
+      blackboxFraction,
+      1,
+      1.minute)
 
   it should "update invoker's state, growing the slots data and keeping valid old data" in {
     // start empty