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-deploy-kube.git


The following commit(s) were added to refs/heads/master by this push:
     new 44d1646  Add simple loadtesting jobs (#158)
44d1646 is described below

commit 44d1646e955092dd32854cfa350e4695113da18e
Author: David Grove <dgrove-...@users.noreply.github.com>
AuthorDate: Tue Feb 13 17:02:32 2018 -0500

    Add simple loadtesting jobs (#158)
    
    Add simple latency and throughput microbenchmaking
    jobs based on incubator-openwhisk-performance.
    
    Also add pod affinity/anti-affinity annotations to help
    guide pods to specific kinds of nodes when deploying
    on larger clusters with mixes of worker nodes.
---
 kubernetes/apigateway/apigateway.yml              | 10 ++++
 kubernetes/cluster-setup/services.yml             |  1 -
 kubernetes/controller/controller.yml              | 15 +++++-
 kubernetes/couchdb/couchdb.yml                    | 10 ++++
 kubernetes/kafka/kafka.yml                        | 10 ++++
 kubernetes/loadtest/README.md                     | 24 ++++++++++
 kubernetes/loadtest/loadtest-latency-internal.yml | 57 ++++++++++++++++++++++
 kubernetes/loadtest/loadtest-latency.yml          | 54 +++++++++++++++++++++
 kubernetes/loadtest/loadtest-throughput.yml       | 58 +++++++++++++++++++++++
 kubernetes/nginx/nginx.yml                        | 10 ++++
 kubernetes/zookeeper/zookeeper.yml                | 10 ++++
 11 files changed, 257 insertions(+), 2 deletions(-)

diff --git a/kubernetes/apigateway/apigateway.yml 
b/kubernetes/apigateway/apigateway.yml
index 119bfbb..70e9d33 100644
--- a/kubernetes/apigateway/apigateway.yml
+++ b/kubernetes/apigateway/apigateway.yml
@@ -26,6 +26,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on a control-plane node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - control-plane
         # do not allow more than 1 apigateway instance to run on a node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/kubernetes/cluster-setup/services.yml 
b/kubernetes/cluster-setup/services.yml
index 0e02ff1..e88cfb7 100644
--- a/kubernetes/cluster-setup/services.yml
+++ b/kubernetes/cluster-setup/services.yml
@@ -57,7 +57,6 @@ metadata:
 spec:
   selector:
     name: controller
-  clusterIP: None
   ports:
     - port: 8080
       targetPort: 8080
diff --git a/kubernetes/controller/controller.yml 
b/kubernetes/controller/controller.yml
index a7a19ce..1a4947e 100644
--- a/kubernetes/controller/controller.yml
+++ b/kubernetes/controller/controller.yml
@@ -27,6 +27,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on a control-plane node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - control-plane
         # do not allow more than 1 controller instance to run on a node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
@@ -194,11 +204,14 @@ spec:
     matchLabels:
       name: controller
   ingress:
-  # Allow nginx to connect to controller
+  # Allow nginx and any pod with access=controller to connect to controller
   - from:
     - podSelector:
         matchLabels:
           name: nginx
+    - podSelector:
+        matchLabels:
+          access: controller
     ports:
      - port: 8080
   # Controllers can connect to each other
diff --git a/kubernetes/couchdb/couchdb.yml b/kubernetes/couchdb/couchdb.yml
index a06aea7..5efc719 100644
--- a/kubernetes/couchdb/couchdb.yml
+++ b/kubernetes/couchdb/couchdb.yml
@@ -44,6 +44,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on a control-plane node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - control-plane
         # do not allow more than 1 couchdb instance to run on a given node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/kubernetes/kafka/kafka.yml b/kubernetes/kafka/kafka.yml
index bc4ca09..3cdf980 100644
--- a/kubernetes/kafka/kafka.yml
+++ b/kubernetes/kafka/kafka.yml
@@ -26,6 +26,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on a control-plane node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - control-plane
         # do not allow more than 1 kafka instance to run on a given node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/kubernetes/loadtest/README.md b/kubernetes/loadtest/README.md
new file mode 100644
index 0000000..5202621
--- /dev/null
+++ b/kubernetes/loadtest/README.md
@@ -0,0 +1,24 @@
+LoadTest
+-----
+
+A collection of jobs to do performance testing
+against openwhisk deployed on kube, based on
+the code in apache/incubator-openwhisk-performance.git.
+
+The jobs are intended to run in the openwhisk namespace in the same
+cluster as the system under test to eliminate external network
+latency.
+
+# Preparing
+
+The Jobs assume the noopLatency and noopThroughput actions are already
+created in the default namespace.  These actions are simple noops
+(for example a JavaScript action whose body is `function main(){return {};}`).
+
+# Runnning
+
+To run one of the Jobs, edit the yml to adjust test parameters and then
+
+```
+kubectl apply -f loadtest-latency.yml
+```
diff --git a/kubernetes/loadtest/loadtest-latency-internal.yml 
b/kubernetes/loadtest/loadtest-latency-internal.yml
new file mode 100644
index 0000000..972eab5
--- /dev/null
+++ b/kubernetes/loadtest/loadtest-latency-internal.yml
@@ -0,0 +1,57 @@
+# This Job measures internal latency (no ingress, no TLS termination) by
+# hitting the controller service directly.
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: loadtest-latency-internal
+  namespace: openwhisk
+spec:
+  activeDeadlineSeconds: 3600
+  template:
+    metadata:
+      name: loadtest-latency-internal
+      labels:
+        access: controller
+    spec:
+      affinity:
+        # do not run on a node that openwhisk is actually using
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - weight: 100
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: NotIn
+                values:
+                - invoker
+                - control-plane
+                - edge
+        # prefer to run on a loadtest node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - loadtest
+      containers:
+      - name: loadtest
+        image: markusthoemmes/loadtest
+        env:
+          # number of samples to gather
+          - name: "NUM_SAMPLES"
+            value: "10000"
+          # base64 encoding of default auth.guest credentials
+          - name: "ENCODED_AUTH"
+            value: 
"MjNiYzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOjEyM3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A="
+          - name: "WHISK_API_HOST_NAME"
+            valueFrom:
+              configMapKeyRef:
+                name: whisk.ingress
+                key: api_host
+        command: ["loadtest"]
+        args: ["-n", "$(NUM_SAMPLES)", "-k", "-m", "POST", "-H", 
"Authorization: basic $(ENCODED_AUTH)", 
"http://$(CONTROLLER_SERVICE_HOST):$(CONTROLLER_SERVICE_PORT)/api/v1/namespaces/_/actions/noopLatency?blocking=true"]
+      restartPolicy: Never
diff --git a/kubernetes/loadtest/loadtest-latency.yml 
b/kubernetes/loadtest/loadtest-latency.yml
new file mode 100644
index 0000000..7a70adc
--- /dev/null
+++ b/kubernetes/loadtest/loadtest-latency.yml
@@ -0,0 +1,54 @@
+# This Job measures end-to-end latency by hitting the public ingress.
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: loadtest-latency
+  namespace: openwhisk
+spec:
+  activeDeadlineSeconds: 3600
+  template:
+    metadata:
+      name: loadtest-latency
+    spec:
+      affinity:
+        # do not run on a node that openwhisk is actually using
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - weight: 100
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: NotIn
+                values:
+                - invoker
+                - control-plane
+                - edge
+        # prefer to run on a loadtest node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - loadtest
+      containers:
+      - name: loadtest
+        image: markusthoemmes/loadtest
+        env:
+          # number of samples to gather
+          - name: "NUM_SAMPLES"
+            value: "10000"
+          # base64 encoding of default auth.guest credentials
+          - name: "ENCODED_AUTH"
+            value: 
"MjNiYzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOjEyM3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A="
+          - name: "WHISK_API_HOST_NAME"
+            valueFrom:
+              configMapKeyRef:
+                name: whisk.ingress
+                key: api_host
+        command: ["loadtest"]
+        args: ["-n", "$(NUM_SAMPLES)", "-k", "-m", "POST", "-H", 
"Authorization: basic $(ENCODED_AUTH)", 
"$(WHISK_API_HOST_NAME)/api/v1/namespaces/_/actions/noopLatency?blocking=true"]
+      restartPolicy: Never
diff --git a/kubernetes/loadtest/loadtest-throughput.yml 
b/kubernetes/loadtest/loadtest-throughput.yml
new file mode 100644
index 0000000..a136a2f
--- /dev/null
+++ b/kubernetes/loadtest/loadtest-throughput.yml
@@ -0,0 +1,58 @@
+# This Job measures throughput obtainable by hitting the public ingress.
+
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: loadtest-throughput-512x1024x300sec
+  namespace: openwhisk
+spec:
+  activeDeadlineSeconds: 3600
+  template:
+    metadata:
+      name: loadtest-throughput-512x1024x300sec
+    spec:
+      affinity:
+        # do not run on a node that openwhisk is actually using
+        nodeAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+          - weight: 100
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: NotIn
+                values:
+                - invoker
+                - control-plane
+                - edge
+        # prefer to run on a loadtest node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - loadtest
+      containers:
+      - name: loadtest
+        image: williamyeh/wrk
+        env:
+          # number of samples to gather
+          - name: "DURATION"
+            value: "300"
+          - name: "CONCURRENCY"
+            value: "1024"
+          - name: "NUM_CORES"
+            value: "512"
+          # base64 encoding of default auth.guest credentials
+          - name: "ENCODED_AUTH"
+            value: 
"MjNiYzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOjEyM3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A="
+          - name: "WHISK_API_HOST_NAME"
+            valueFrom:
+              configMapKeyRef:
+                name: whisk.ingress
+                key: api_host
+        command: ["/bin/sh"]
+        args: ["-c", "echo wrk.method = \\\"POST\\\" > post.lua; wrk --threads 
$(NUM_CORES) --connections $(CONCURRENCY) --duration $(DURATION) --header 
\"Authorization: basic $(ENCODED_AUTH)\" 
$(WHISK_API_HOST_NAME)/api/v1/namespaces/_/actions/noopThroughput?blocking=true 
--latency --timeout 10s --script post.lua"]
+      restartPolicy: Never
diff --git a/kubernetes/nginx/nginx.yml b/kubernetes/nginx/nginx.yml
index e69c77f..5b76834 100644
--- a/kubernetes/nginx/nginx.yml
+++ b/kubernetes/nginx/nginx.yml
@@ -26,6 +26,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on an edge node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - edge
         # do not allow more than 1 nginx instance to run on a given node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
diff --git a/kubernetes/zookeeper/zookeeper.yml 
b/kubernetes/zookeeper/zookeeper.yml
index 15f1b74..41cdd1d 100644
--- a/kubernetes/zookeeper/zookeeper.yml
+++ b/kubernetes/zookeeper/zookeeper.yml
@@ -25,6 +25,16 @@ spec:
                 operator: NotIn
                 values:
                 - invoker
+        # prefer to run on a control-plane node
+        nodeAffinity:
+          preferredDuringSchedulingIgnoredDuringExecution:
+          - weight: 50
+            preference:
+              matchExpressions:
+              - key: openwhisk-role
+                operator: In
+                values:
+                - control-plane
         # do not allow more than 1 zookeeper instance to run on a given node
         podAntiAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:

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

Reply via email to