diff --git a/.gitignore b/.gitignore index a3a2098b..4850d881 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,7 @@ terraform.tfstate* # dotenv -.env \ No newline at end of file +.env + +# python cache (locust) +__pycache__/ \ No newline at end of file diff --git a/DEVELOPING.md b/DEVELOPING.md index e7cc0153..bc180c83 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -12,6 +12,7 @@ Recommended: - [K9s](https://k9scli.io/) - A Terminal UI for Kubernetes - [remake](https://remake.readthedocs.io/) - A better make - View them with `remake --tasks` +- [locust](https://docs.locust.io/en/stable/what-is-locust.html) - A performance testing tool, required for load testing ## Local Development @@ -114,6 +115,20 @@ Hit the endpoint: `make unapply-greetings` or `kubectl delete -f smoke-tests/greetings.yaml` +## Load Testing + +After a locally built image and an API key is set: + +`make swarm` + +This will apply the agent, apply the echoserver, and start locust. + +Navigate to `http://0.0.0.0:8089/` in your browser and set users and spawn rate, e.g. 5000 and 100, and hit Start swarming. + +To tear down the load test, `ctrl+c` in the terminal running and `make unswarm`. + +See more details in [`smoke-tests/loadtest.md`](./smoke-tests/loadtest.md) + ## Debugging From an agent pod terminal, which must be run in privileged mode: diff --git a/Makefile b/Makefile index a6f1a710..d63caa73 100644 --- a/Makefile +++ b/Makefile @@ -59,3 +59,15 @@ apply-greetings: .PHONY: unapply-greetings unapply-greetings: kubectl delete -f smoke-tests/greetings.yaml + +# deploy echoserver in already-running cluster and start locust +.PHONY: swarm +swarm: apply-ebpf-agent + kubectl apply -f smoke-tests/echoserver.yaml + cd smoke-tests && locust + +# teardown load test setup +.PHONY: unswarm +unswarm: + kubectl delete -f smoke-tests/echoserver.yaml + make unapply-ebpf-agent diff --git a/smoke-tests/echoserver.yaml b/smoke-tests/echoserver.yaml index 38281d81..9f3ade1a 100644 --- a/smoke-tests/echoserver.yaml +++ b/smoke-tests/echoserver.yaml @@ -40,4 +40,4 @@ spec: - name: http port: 80 targetPort: 80 - type: LoadBalancers \ No newline at end of file + type: LoadBalancer \ No newline at end of file