Load Test gRPC with SLOs¶
Load test a Kubernetes gRPC service and validate its service-level objectives (SLOs). This is a single-loop Kubernetes experiment.
See Load Test multiple gRPC methods to see a tutorial that describes how to load test multiple methods from an gRPC service.
Before you begin
- Try your first experiment. Understand the main concepts behind Iter8 experiments.
- 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
Launch experiment¶
iter8 k launch \
--set "tasks={ready,grpc,assess}" \
--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.13.13/samples/grpc-payload/unary.json \
--set assess.SLOs.upper.grpc/error-rate=0 \
--set assess.SLOs.upper.grpc/latency/mean=200 \
--set assess.SLOs.upper.grpc/latency/p'97\.5'=800 \
--set runner=job
iter8 k launch \
--set "tasks={ready,grpc,assess}" \
--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.13.13/samples/grpc-payload/server.json \
--set assess.SLOs.upper.grpc/error-rate=0 \
--set assess.SLOs.upper.grpc/latency/mean=200 \
--set assess.SLOs.upper.grpc/latency/p'97\.5'=800 \
--set runner=job
iter8 k launch \
--set tasks={ready,grpc,assess} \
--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.13.13/samples/grpc-payload/client.json \
--set assess.SLOs.upper.grpc/error-rate=0 \
--set assess.SLOs.upper.grpc/latency/mean=200 \
--set assess.SLOs.upper.grpc/latency/p'97\.5'=800 \
--set runner=job
iter8 k launch \
--set "tasks={ready,grpc,assess}" \
--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.13.13/samples/grpc-payload/bidirectional.json \
--set assess.SLOs.upper.grpc/error-rate=0 \
--set assess.SLOs.upper.grpc/latency/mean=200 \
--set assess.SLOs.upper.grpc/latency/p'97\.5'=800 \
--set runner=job
About this experiment
This experiment consists of three tasks, namely, ready, grpc, and assess.
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
.
The assess task verifies if the app satisfies the specified SLOs: i) there are no errors, ii) the mean latency of the service does not exceed 50 msec, and iii) the 97.5
th percentile latency does not exceed 200 msec.
This is a single-loop Kubernetes experiment where all the previously mentioned tasks will run once and the experiment will finish. Hence, its runner value is set to job
.
Some variations and extensions of this experiment
- 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.
- The assess task can be configured with SLOs for any of Iter8's built-in grpc load test metrics.
Assert experiment outcomes, view experiment report, view experiment logs, and cleanup as described in your first experiment.
Cleanup¶
Remove the Iter8 experiment and the sample app from the Kubernetes cluster and the local Iter8 charts
folder.
iter8 k delete
kubectl delete svc/routeguide
kubectl delete deploy/routeguide