Load test gRPC method¶
Load test a Kubernetes gRPC service and visualize the performance metrics with an Iter8 Grafana dashboard.
Before you begin
- Try Your first performance test. Understand the main concepts behind.
-
Deploy the sample gRPC service in the Kubernetes cluster.
kubectl create deployment routeguide --image=golang --port=50051 \ -- bash -c "git clone -b v1.52.0 --depth 1 https://github.com/grpc/grpc-go; cd grpc-go/examples/route_guide; sed -i "''" "'"s/localhost//"'" server/server.go; go run server/server.go" kubectl expose deployment routeguide --port=50051
-
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¶
Iter8 can be installed and configured to watch resources either in a single namespace (namespace-scoped) or in the whole cluster (cluster-scoped).
helm install --repo https://iter8-tools.github.io/iter8 --version 1.1 iter8 controller
helm install --repo https://iter8-tools.github.io/iter8 --version 1.1 iter8 controller \
--set clusterScoped=true
For additional install options, see Iter8 Installation.
Launch performance test¶
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 1.1 routeguide-test iter8 \
--set "tasks={ready,grpc}" \
--set ready.deploy=routeguide \
--set ready.service=routeguide \
--set ready.timeout=60s \
--set grpc.host=routeguide.default:50051 \
--set grpc.protoURL=https://raw.githubusercontent.com/grpc/grpc-go/v1.52.0/examples/route_guide/routeguide/route_guide.proto \
--set grpc.call=routeguide.RouteGuide.GetFeature \
--set grpc.dataURL=https://raw.githubusercontent.com/iter8-tools/docs/v0.17.3/samples/grpc-payload/unary.json
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 1.1 routeguide-test iter8 \
--set "tasks={ready,grpc}" \
--set ready.deploy=routeguide \
--set ready.service=routeguide \
--set ready.timeout=60s \
--set grpc.host=routeguide.default:50051 \
--set grpc.protoURL=https://raw.githubusercontent.com/grpc/grpc-go/v1.52.0/examples/route_guide/routeguide/route_guide.proto \
--set grpc.call=routeguide.RouteGuide.ListFeatures \
--set grpc.dataURL=https://raw.githubusercontent.com/iter8-tools/docs/v0.17.3/samples/grpc-payload/server.json
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 1.1 routeguide-test iter8 \
--set "tasks={ready,grpc}" \
--set ready.deploy=routeguide \
--set ready.service=routeguide \
--set ready.timeout=60s \
--set grpc.host=routeguide.default:50051 \
--set grpc.protoURL=https://raw.githubusercontent.com/grpc/grpc-go/v1.52.0/examples/route_guide/routeguide/route_guide.proto \
--set grpc.call=routeguide.RouteGuide.RecordRoute \
--set grpc.dataURL=https://raw.githubusercontent.com/iter8-tools/docs/v0.17.3/samples/grpc-payload/client.json
helm upgrade --install \
--repo https://iter8-tools.github.io/iter8 --version 1.1 routeguide-test iter8 \
--set "tasks={ready,grpc}" \
--set ready.deploy=routeguide \
--set ready.service=routeguide \
--set ready.timeout=60s \
--set grpc.host=routeguide.default:50051 \
--set grpc.protoURL=https://raw.githubusercontent.com/grpc/grpc-go/v1.52.0/examples/route_guide/routeguide/route_guide.proto \
--set grpc.call=routeguide.RouteGuide.RouteChat \
--set grpc.dataURL=https://raw.githubusercontent.com/iter8-tools/docs/v0.17.3/samples/grpc-payload/bidirectional.json
About this performance test
This performance test consists of two tasks, namely, ready, and grpc.
The ready task checks if the routeguide
deployment exists and is available, and the routeguide
service exists.
The grpc task sends call requests to the specified method of the cluster-local gRPC service with host address routeguide.default:50051
and collects Iter8's built-in gRPC load test metrics. This task supports all four gRPC service methods: unary, server streaming, client streaming, and bidirectional streaming, and will provide payload in the appropriate manner using dataURL
.
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 in a browser by going to http://localhost:3000 and login. The default username/password are admin
/admin
.
Add a JSON API data source routeguide-test
with the following parameters:
- URL:
http://iter8.default:8080/grpcDashboard
- Query string:
namespace=default&test=routeguide-test
Create a new dashboard by import. Paste the contents of the grpc
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=routeguide-test
Cleanup¶
Remove the performance test and the sample app from the Kubernetes cluster.
helm delete routeguide-test
kubectl delete svc/routeguide
kubectl delete deploy/routeguide
Uninstall the Iter8 controller¶
helm delete iter8
For additional uninstall options, see Iter8 Uninstall.
If you installed Grafana, you can delete it as follows:
kubectl delete svc/grafana deploy/grafana
Some variations and extensions of this performance test
- The grpc task can be configured with load related parameters such as the total number of requests, requests per second, or number of concurrent connections.