You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/08/27 11:26:10 UTC

[GitHub] WillemJiang closed pull request #273: Add the document of load testing.

WillemJiang closed pull request #273: Add the document of load testing.
URL: https://github.com/apache/incubator-servicecomb-saga/pull/273
 
 
   

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/docs/load_test.md b/docs/load_test.md
new file mode 100644
index 00000000..dccdb01a
--- /dev/null
+++ b/docs/load_test.md
@@ -0,0 +1,49 @@
+### Load testing saga with Kubernetes
+
+First make sure a [saga-demo](https://github.com/apache/incubator-servicecomb-saga/tree/master/saga-demo) is running in the kubernetes cluster(you can find useful info at [saga's k8s demo](https://github.com/apache/incubator-servicecomb-saga/tree/master/saga-demo/saga-k8s-resources)), here we take the [saga-spring-demo](https://github.com/apache/incubator-servicecomb-saga/tree/master/saga-demo/saga-spring-demo) as an example.
+
+Navigate to `saga-demo/saga-k8s-resources/spring-demo/test`, there is a jmeter service and corresponding configmap where jmeter's
+
+There is a jmeter service definition in jmeter.yaml, and a configmap where the jmeter service's config is stored. We first deploy the configmap in the cluster:
+
+```bash
+$ kubectl aplly -f ./jmeter.config.yaml
+configmap "springdemo-jmeter-script" created
+```
+
+So the configmap is there in the cluster, we can edit it any time with `kubectl edit`:
+
+```bash
+$ kubectl edit configmap springdemo-jmeter-script -n servicecomb
+```
+
+Adjust the testing parameters, you may be interested in `ThreadGroup.num_threads`, `ThreadGroup.ramp_time`, `ThreadGroup.duration`, which are: the number of max testing threads, the duration to start the max threads and the total testing time.
+
+Then we deploy the jmeter service:
+
+```bash
+$ kubectl apply -f ./jmeter.yaml
+```
+
+If you're interested in what's going on inside the service, open the jmeter.yaml file, and you'll see the configmap is delivered to jmeter through a volume mount:
+
+```yaml
+# ...
+containers:
+- name: spring-demo-jmeter
+env:
+- name: REPORT_UPLOAD_SERVER
+  value: jmeter-collector.servicecomb
+# ...
+  volumeMounts:
+  - name: jmeter-script
+    mountPath: /tmp/
+volumes:
+  - name: jmeter-script
+    configMap:
+      name: springdemo-jmeter-script
+```
+
+What's more, when we deploy the resources in spring-demo's base folder, a `jmeter-collector` service is started, it will receive the jmeter service's uploading archives. The collector's upload URL is defined in environment variable `REPORT_UPLOAD_SERVER`.
+
+Since the jmeter service's instance is defined in a [kubernetes deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/), the restartPolicy will be 'Always', it will keep testing, uploading, exiting, restarting again and again. When we want to adjust the load test parameter, we edit the configmap with `kubectl edit`, save it, restart the `jmeter` deployment and test with the new parameters.
\ No newline at end of file
diff --git a/saga-demo/saga-k8s-resources/README.md b/saga-demo/saga-k8s-resources/README.md
index 894bd88b..a84a6cae 100644
--- a/saga-demo/saga-k8s-resources/README.md
+++ b/saga-demo/saga-k8s-resources/README.md
@@ -4,7 +4,7 @@ You can now play with saga under Kubernetes!
 
 The demos' Kubernetes resources are splitted into 3 categories:
 
-- **base**: The base resources that all demos needs under `base/` folder, including the `alpha-server` and `postgresql` database
+- **base**: The base resources that all demos needs under `base/` folder, including the `alpha-server,`the `postgresql` database, and a `jmeter-collector` for [load test](https://github.com/apache/incubator-servicecomb-saga/blob/master/docs/load_test.md).
 - **demos**: The resources that each demo will consume, stored in the folder named with `xxx-demo/`
 - **tests**: A [jmeter](https://jmeter.apache.org/) deployment is provided for each demo under the demo's `test/` folder, there is also a [Kubernetes configmap](http://kubernetes-v1-4.github.io/docs/user-guide/configmap/) where you can change and apply the jmeter test plans. So you can change the plan at any time and pull up the jmeter deployment to test the demos.
 
diff --git a/saga-demo/saga-k8s-resources/base/alpha.yaml b/saga-demo/saga-k8s-resources/base/alpha.yaml
index 79298d8c..1dd303a6 100644
--- a/saga-demo/saga-k8s-resources/base/alpha.yaml
+++ b/saga-demo/saga-k8s-resources/base/alpha.yaml
@@ -25,7 +25,9 @@ metadata:
 spec:
   ports:
   - port: 8080
-    name: alpha
+    name: alpha-http
+  - port: 8090
+    name: alpha-grpc
   selector:
     app: alphaserver
 ---


 

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