This is a sample of using Gatling to run a load test against Cloudstate services. Cloudstate is a specification, protocol, and reference implementation for providing distributed state management patterns suitable for Serverless computing.
If you deploy the sample shopping cart js-shopping-cart you can use this repository to run a load test against it, that tests various functions.
In sbt
gatling-it:testOnly shoppingcart.ShoppingCartSimulation1
- Add the protobuf files for your service API in
src/main/protobuf
- Copy the folder
src/it/scala/shoppingcart
and rename it to match your service - Make a gatling test copying the example from
ShoppingCartSimulation1.scala
that calls your endpoints
You may need to consult the Gatling documumentation to explore its full range of functionality.
This project uses Gatling as a plugin along with grpc to handle the protobuf compilation and gatling-grpc so that we can write Gatling load tests over gRPC instead of HTTP.
> gatling:test
sbt "gatling-it:testOnly shoppingcart.ShoppingCartSimulation1"
Run the shopping cart simulation at the command line and direct to a particular server. Note that if you are running the shopping cart service in Kubernetes cluster, you need to port forward from the akka-sidecar container so you can access it directly with the load test. (The load test uses gRPC not grpc-web protocol).
GATLING_PORT=[PORT] GATLING_USERS=[NUM USERS] GATLING_HOST=[YOUR HOST] sbt gatling-it:testOnly shoppingcart.ShoppingCartSimulation1
> tasks gatling -v
https://github.com/gatling/gatling-sbt-plugin-demo https://github.com/phiSgr/gatling-grpc https://medium.com/@georgeleung_7777/a-demo-of-gatling-grpc-bc92158ca808