You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2019/01/07 20:42:50 UTC

[incubator-openwhisk] branch master updated: Make exec aka code max size configurable (#4156)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 57c5e9e  Make exec aka code max size configurable (#4156)
57c5e9e is described below

commit 57c5e9eae02f554adbca78b1fa2346fe1bd11b0c
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Tue Jan 8 02:12:44 2019 +0530

    Make exec aka code max size configurable (#4156)
    
    Factors out the max size of 48MB for the exec blog to a deployment parameter. This makes it easier to lower the limit but not yet increase it.
---
 common/scala/src/main/resources/application.conf          |  3 +++
 .../scala/org/apache/openwhisk/core/WhiskConfig.scala     |  1 +
 .../scala/org/apache/openwhisk/core/entity/Exec.scala     | 15 ++++++++++-----
 docs/reference.md                                         |  4 ++--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/common/scala/src/main/resources/application.conf b/common/scala/src/main/resources/application.conf
index 1f31d83..40c98a7 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -234,6 +234,9 @@ whisk {
         std = 1
     }
 
+    # maximum size of the action code
+    exec-size-limit = 48 m
+
     query-limit {
         max-list-limit     = 200  # max number of entities that can be requested from a collection on a list operation
         default-list-limit = 30   # default limit on number of entities returned from a collection on a list operation
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
index 019f37f..8dd7810 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
@@ -239,5 +239,6 @@ object ConfigKeys {
 
   val s3 = "whisk.s3"
   val query = "whisk.query-limit"
+  val execSizeLimit = "whisk.exec-size-limit"
 
 }
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
index c5b13c1..f228e2e 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
@@ -19,15 +19,17 @@ package org.apache.openwhisk.core.entity
 
 import java.nio.charset.StandardCharsets
 
-import scala.language.postfixOps
-import scala.util.matching.Regex
+import org.apache.openwhisk.core.ConfigKeys
 
+import scala.util.matching.Regex
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import org.apache.openwhisk.core.entity.Attachments._
 import org.apache.openwhisk.core.entity.ExecManifest._
 import org.apache.openwhisk.core.entity.size.SizeInt
+import org.apache.openwhisk.core.entity.size._
 import org.apache.openwhisk.core.entity.size.SizeString
+import pureconfig.loadConfigOrThrow
 
 /**
  * Exec encodes the executable details of an action. For black
@@ -227,7 +229,12 @@ protected[core] case class SequenceExecMetaData(components: Vector[FullyQualifie
 
 protected[core] object Exec extends ArgNormalizer[Exec] with DefaultJsonProtocol {
 
-  val sizeLimit = 48 MB
+  val maxSize: ByteSize = 48.MB
+  val sizeLimit = loadConfigOrThrow[ByteSize](ConfigKeys.execSizeLimit)
+
+  require(
+    sizeLimit <= maxSize,
+    s"Executable code size limit $sizeLimit specified by '${ConfigKeys.execSizeLimit}' should not be more than max size of $maxSize")
 
   // The possible values of the JSON 'kind' field for certain runtimes:
   // - Sequence because it is an intrinsic
@@ -360,8 +367,6 @@ protected[core] object Exec extends ArgNormalizer[Exec] with DefaultJsonProtocol
 
 protected[core] object ExecMetaDataBase extends ArgNormalizer[ExecMetaDataBase] with DefaultJsonProtocol {
 
-  val sizeLimit = 48 MB
-
   // The possible values of the JSON 'kind' field for certain runtimes:
   // - Sequence because it is an intrinsic
   // - Black Box because it is a type marker
diff --git a/docs/reference.md b/docs/reference.md
index 7feaa6f..c1a3adb 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -81,7 +81,7 @@ The following table lists the default limits for actions.
 | logs | a container is not allowed to write more than N MB to stdout | per action | MB | 10 |
 | concurrent | no more than N activations may be submitted per namespace either executing or queued for execution | per namespace | number | 100 |
 | minuteRate | no more than N activations may be submitted per namespace per minute | per namespace | number | 120 |
-| codeSize | the maximum size of the actioncode | not configurable, limit per action | MB | 48 |
+| codeSize | the maximum size of the actioncode | configurable, limit per action | MB | 48 |
 | parameters | the maximum size of the parameters that can be attached | not configurable, limit per action/package/trigger | MB | 1 |
 | result | the maximum size of the action result | not configurable, limit per action | MB | 1 |
 
@@ -100,7 +100,7 @@ The following table lists the default limits for actions.
 * A user can change the limit when creating or updating the action.
 * Logs that exceed the set limit are truncated and a warning is added as the last output of the activation to indicate that the activation exceeded the set log limit.
 
-### Per action artifact (MB) (Fixed: 48MB)
+### Per action artifact (MB) (Default: 48MB)
 * The maximum code size for the action is 48MB.
 * It is recommended for a JavaScript action to use a tool to concatenate all source code including dependencies into a single bundled file.