Skip to content

Commit

Permalink
maint: fix load test (#148)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?

The Service "echoserver" is invalid: spec.type: Unsupported value:
"LoadBalancers": supported values: "ClusterIP", "ExternalName",
"LoadBalancer", "NodePort"

## Short description of the changes

- Fix typo on LoadBalancers to be LoadBalancer
- Add make targets for easy load testing
- Add notes to `DEVELOPING.md` doc for load testing
- Add `.gitignore` for temp locust file

## How to verify that this has the expected result

Follow notes in `DEVELOPING.md` for successful load testing

```sh
make docker-build
make loadtest
# start swarming
make unload
```
  • Loading branch information
JamieDanielson committed Sep 7, 2023
1 parent c1645ad commit 8d4879b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
terraform.tfstate*

# dotenv
.env
.env

# python cache (locust)
__pycache__/
15 changes: 15 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion smoke-tests/echoserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ spec:
- name: http
port: 80
targetPort: 80
type: LoadBalancers
type: LoadBalancer

0 comments on commit 8d4879b

Please sign in to comment.