Locust is an open-source, distributed, and scalable load testing tool used for measuring the performance and scalability of web applications. It is typically used to simulate thousands or even millions of users, known as "virtual users," to generate a load on the application and observe its behavior under different conditions.
When deployed on Kubernetes, Locust can be configured to run multiple worker nodes, allowing for even greater scalability and load generation. Kubernetes provides a highly available and scalable platform for running Locust, and makes it easy to spin up additional worker nodes as needed to handle large-scale load testing scenarios.
This is a locust setup in a k8s cluster, with 1 master and 2 worker nodes. The number of worker nodes can be changed in locust-worker.yaml
, line 8
if desired.
[DIAGRAM HERE]
The following demo is for setting up a cluster locally, using k3d. This could also be done using minikube or even in the cloud.
NOTE: when setting up this cluster in the cloud, you would need to create a yaml file for a load balancer listening on port 8089.
Please refer to your cloud providers documentation.
Have following installed on your computer
✔️ Docker
✔️ Minikube / k3d / MicroK8s... (if deploying locally)
✔️ A k8s cluster in AWS / google cloud / Azure... (if deploying in the cloud)
✔️ kubectl
git clone https://github.com/RenoDeCorte/locust-in-k8s-cluster.git
cd locust-in-k8s-cluster
./locust.sh
Wait for a few minutes and visit localhost:8089
. You should see the locust interface with 2 workers: