Skip to content

Commit a8d2a7e

Browse files
committed
1-autoscaling.md
1 parent 30356e0 commit a8d2a7e

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

docs/5-the-deployments-strike-back/1-autoscaling.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,29 @@
6464

6565
4. With the change synchronized, we should see a new object in ArgoCD and the cluster. Feel free to check those out.
6666

67-
5. Let's now test our pod autoscaler, to do this we want to fire lots of load on the API of pet-battle. This should trigger an autoscale due to the increased load on the pods. `hey` is simple load testing tool that can be run from the command line that will fire lots of load at our endpoint:
67+
5. Let's now test our pod autoscaler, to do this we want to fire lots of load on the API of pet-battle. This should trigger an autoscale due to the increased load on the pods. `k6` is simple load testing tool that can be run from the command line that will fire lots of load at our endpoint:
68+
69+
First, create the load.js javascript file that defines the load test type to run.
70+
71+
```javascript
72+
cat << EOF > /tmp/load.js
73+
import http from 'k6/http';
74+
import { sleep } from 'k6';
75+
export default function () {
76+
http.get('https://$(oc get route/pet-battle-api -n ${TEAM_NAME}-test --template='{{.spec.host}}')/cats');
77+
}
78+
EOF
79+
```
80+
81+
Then, using the `k6` binary, run the load test using more than one virtual user and a defined duration.
6882

6983
```bash
70-
hey -t 30 -c 10 -n 10000 -H "Content-Type: application/json" -m GET https://$(oc get route/pet-battle-api -n ${TEAM_NAME}-test --template='{{.spec.host}}')/cats
84+
k6 run --insecure-skip-tls-verify --vus 100 --duration 30s /tmp/load.js
7185
```
7286

7387
Where:
74-
* -c: Number of workers to run concurrently (10)
75-
* -n: Number of requests to run (10,000)
76-
* -t: Timeout for each request in seconds (30)
88+
* --vus: Number of virtual users (VUs) to run concurrently (100)
89+
* --duration: Test duration limit (30s)
7790

7891
6. While this is running, we should see in OpenShift land the autoscaler is kickin in and spinnin gup additional pods. If you navigate to the pet-battle-api deployment, you should see the replica count has jumped.
7992

0 commit comments

Comments
 (0)