Load test multiple HTTP endpoints¶
Your first performance test describes how to load test a HTTP service. This tutorial expands on the previous tutorial and describes how to load test multiple HTTP endpoints.
Before you begin
- Try Your first performance test. Understand the main concepts behind Iter8.
- Ensure that you have a Kubernetes cluster and the
kubectl
CLI. You can create a local Kubernetes cluster using tools like Kind or Minikube. - Deploy the sample HTTP service in the Kubernetes cluster.
kubectl create deploy httpbin --image=kennethreitz/httpbin --port=80 kubectl expose deploy httpbin --port=80
- Have Grafana available. For example, Grafana can be installed on your cluster as follows:
kubectl create deploy grafana --image=grafana/grafana kubectl expose deploy grafana --port=3000
Install the Iter8 controller¶
helm install --repo https://iter8-tools.github.io/iter8 --version 0.1.12 iter8 controller
helm install --repo https://iter8-tools.github.io/iter8 --version 0.1.12 iter8 controller \
--set clusterScoped=true
kubectl apply -k 'https://github.com/iter8-tools/iter8.git/kustomize/controller/namespaceScoped?ref=v0.17.1'
kubectl apply -k 'https://github.com/iter8-tools/iter8.git/kustomize/controller/clusterScoped?ref=v0.17.1'
Launch performance test¶
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 0.17 httpbin-test iter8 \
--set "tasks={ready,http}" \
--set ready.deploy=httpbin \
--set ready.service=httpbin \
--set ready.timeout=60s \
--set http.endpoints.get.url=http://httpbin.default/get \
--set http.endpoints.getAnything.url=http://httpbin.default/anything \
--set http.endpoints.post.url=http://httpbin.default/post \
--set http.endpoints.post.payloadStr=hello
About this performance test
This performance test consists of two tasks, namely, ready and http.
The ready task checks if the httpbin
deployment exists and is available, and the httpbin
service exists.
The http task sends requests to three endpoints from the cluster-local HTTP service, and collects Iter8's built-in HTTP load test metrics. The three endpoints are http://httpbin.default/get
, http://httpbin.default/anything
, and http://httpbin.default/post
. The last endpoint also has a payload string hello
.
View results using Grafana¶
Inspect the metrics using Grafana. If Grafana is deployed to your cluster, port-forward requests as follows:
kubectl port-forward service/grafana 3000:3000
Open Grafana by going to http://localhost:3000.
Add a JSON API data source httpbin-test
with the following parameters:
- URL:
http://iter8.default:8080/httpDashboard
- Query string:
namespace=default&test=httpbin-test
Create a new dashboard by import. Paste the contents of the http
Grafana dashboard into the text box and load it. Associate it with the JSON API data source defined above.
The Iter8 dashboard will look like the following:
View logs¶
Logs are useful for debugging.
kubectl logs -l iter8.tools/test=httpbin-test
Cleanup¶
Remove the performance test and the sample app from the Kubernetes cluster.
helm delete httpbin-test
kubectl delete svc/httpbin
kubectl delete deploy/httpbin
Uninstall the Iter8 controller¶
helm delete iter8
kubectl delete -k 'https://github.com/iter8-tools/iter8.git/kustomize/controller/namespaceScoped?ref=v0.17.1'
kubectl delete -k 'https://github.com/iter8-tools/iter8.git/kustomize/controller/clusterScoped?ref=v0.17.1'