You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/04/25 06:00:24 UTC

[GitHub] markusthoemmes closed pull request #3427: Add Gatling tests to test performance.

markusthoemmes closed pull request #3427: Add Gatling tests to test performance.
URL: https://github.com/apache/incubator-openwhisk/pull/3427
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.travis.yml b/.travis.yml
index f5b0fd8e38..395d04eeef 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 f8179047cb..17ec2ce2f2 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 0000000000..79f2751dbf
--- /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))
+}


 

----------------------------------------------------------------
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