You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2018/04/25 06:00:27 UTC

[incubator-openwhisk] branch master updated: Add simulation to test warm invocation throughput. (#3427)

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

markusthoemmes 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 8da57de  Add simulation to test warm invocation throughput. (#3427)
8da57de is described below

commit 8da57de213a61200305d093bf84e5c0825a9402e
Author: Christian Bickel <gi...@cbickel.de>
AuthorDate: Wed Apr 25 08:00:23 2018 +0200

    Add simulation to test warm invocation throughput. (#3427)
---
 .travis.yml                                        |  1 +
 performance/README.md                              | 27 ++++++++
 .../scala/BlockingInvokeOneActionSimulation.scala  | 79 ++++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index f5b0fd8..395d04e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -66,5 +66,6 @@ jobs:
         - TERM=dumb ./performance/wrk_tests/throughput.sh "https://172.17.0.1:10001" "$(cat ansible/files/auth.guest)" 4 2 2m
         - OPENWHISK_HOST="172.17.0.1" CONNECTIONS="100" REQUESTS_PER_SEC="1" ./gradlew gatlingRun-ApiV1Simulation
         - OPENWHISK_HOST="172.17.0.1" MEAN_RESPONSE_TIME="1000" API_KEY="$(cat ansible/files/auth.guest)" EXCLUDED_KINDS="python:default,java:default,swift:default" ./gradlew gatlingRun-LatencySimulation
+        - OPENWHISK_HOST="172.17.0.1" API_KEY="$(cat ansible/files/auth.guest)" CONNECTIONS="100" REQUESTS_PER_SEC="1" ./gradlew gatlingRun-BlockingInvokeOneActionSimulation
       env:
         - DESCRIPTION="Execute wrk-performance test suite."
diff --git a/performance/README.md b/performance/README.md
index f817904..17ec2ce 100644
--- a/performance/README.md
+++ b/performance/README.md
@@ -108,3 +108,30 @@ You can run the simulation with (in OPENWHISK_HOME)
 ```
 OPENWHISK_HOST="openwhisk.mydomain.com" MEAN_RESPONSE_TIME="20" API_KEY="UUID:KEY" ./gradlew gatlingRun-LatencySimulation
 ```
+
+##### BlockingInvokeOneActionSimulation
+
+This simulation executes the same action with the same user over and over again.
+The aim of this test is, to test the throughput of the system, if all containers are always warm.
+
+The action that is invoked, writes one log line and returns a little json.
+
+The simulations creates the action in the beginning, invokes it as often as possible for 5 seconds, to warm all containers up and invokes it afterwards for the given amount of time.
+The warmup-phase will not be part of the assertions.
+
+To run the test, you can specify the amount of concurrent requests. Keep in mind, that the actions are invoked blocking and the system is limited to `AMOUNT_OF_INVOKERS * SLOTS_PER_INVOKER * NON_BLACKBOX_INVOKER_RATIO` concurrent actions/requests.
+
+Available environment variables:
+```
+OPENWHISK_HOST          (required)
+API_KEY                 (required, format: UUID:KEY)
+CONNECTIONS             (required)
+SECONDS                 (default: 10)
+REQUESTS_PER_SEC        (required)
+MIN_REQUESTS_PER_SEC    (default: REQUESTS_PER_SEC)
+```
+
+You can run the simulation with
+```
+OPENWHISK_HOST="openwhisk.mydomain.com" CONNECTIONS="10" REQUESTS_PER_SEC="50" API_KEY="UUID:KEY" ./gradlew gatlingRun-BlockingInvokeOneActionSimulation
+```
diff --git a/performance/gatling_tests/src/gatling/scala/BlockingInvokeOneActionSimulation.scala b/performance/gatling_tests/src/gatling/scala/BlockingInvokeOneActionSimulation.scala
new file mode 100644
index 0000000..79f2751
--- /dev/null
+++ b/performance/gatling_tests/src/gatling/scala/BlockingInvokeOneActionSimulation.scala
@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import java.nio.charset.StandardCharsets
+
+import extension.whisk.OpenWhiskProtocolBuilder
+import extension.whisk.Predef._
+import io.gatling.core.Predef._
+import io.gatling.core.structure.ScenarioBuilder
+import io.gatling.core.util.Resource
+import org.apache.commons.io.FileUtils
+
+import scala.concurrent.duration._
+
+class BlockingInvokeOneActionSimulation extends Simulation {
+  // Specify parameters for the run
+  val host = sys.env("OPENWHISK_HOST")
+
+  // Specify authentication
+  val Array(uuid, key) = sys.env("API_KEY").split(":")
+
+  val connections: Int = sys.env("CONNECTIONS").toInt
+  val seconds: FiniteDuration = sys.env.getOrElse("SECONDS", "10").toInt.seconds
+
+  // Specify thresholds
+  val requestsPerSec: Int = sys.env("REQUESTS_PER_SEC").toInt
+  val minimalRequestsPerSec: Int = sys.env.getOrElse("MIN_REQUESTS_PER_SEC", requestsPerSec.toString).toInt
+
+  // Generate the OpenWhiskProtocol
+  val openWhiskProtocol: OpenWhiskProtocolBuilder = openWhisk.apiHost(host)
+
+  val actionName = "testActionForBlockingInvokeOneAction"
+
+  // Define scenario
+  val test: ScenarioBuilder = scenario("Invoke one action blocking")
+    .doIf(_.userId == 1) {
+      exec(
+        openWhisk("Create action")
+          .authenticate(uuid, key)
+          .action(actionName)
+          .create(FileUtils
+            .readFileToString(Resource.body("nodeJSAction.js").get.file, StandardCharsets.UTF_8)))
+    }
+    .rendezVous(connections)
+    .during(5.seconds) {
+      exec(openWhisk("Warm containers up").authenticate(uuid, key).action(actionName).invoke())
+    }
+    .rendezVous(connections)
+    .during(seconds) {
+      exec(openWhisk("Invoke action").authenticate(uuid, key).action(actionName).invoke())
+    }
+    .rendezVous(connections)
+    .doIf(_.userId == 1) {
+      exec(openWhisk("Delete action").authenticate(uuid, key).action(actionName).delete())
+    }
+
+  setUp(test.inject(atOnceUsers(connections)))
+    .protocols(openWhiskProtocol)
+    // One failure will make the build yellow
+    .assertions(details("Invoke action").requestsPerSec.gt(minimalRequestsPerSec))
+    .assertions(details("Invoke action").requestsPerSec.gt(requestsPerSec))
+    // Mark the build yellow, if there are failed requests. And red if both conditions fail.
+    .assertions(details("Invoke action").failedRequests.count.is(0))
+    .assertions(details("Invoke action").failedRequests.percent.lte(0.1))
+}

-- 
To stop receiving notification emails like this one, please contact
markusthoemmes@apache.org.