We use the Locust framework (http://locust.io/). Here is how to run load testing against your local environment only. For instructions about how to run load testing against production, please see README.md
in our private repository.
The load testing is designed to run directly from your vagrant VM using 4 cores (feel free to adjust this to your own number of CPUs). It runs in distributed mode (4 locust slaves and 1 master running the web interface).
- First double check your vagrant VM settings directly in VirtualBox interface. You should ensure that your VM uses 4 CPUs and not the default 1 CPU only. You have to make this change once, and you'll most likely need to reboot the VM to do it. Without this change, your VM CPU usage might quickly become the bottleneck of the load testing.
- Read
labonneboite/scripts/loadtesting.py
script and adjust values to your load testing scenario. - Start your local server
make serve-web-app
- Start your locust instance
make start-locust-against-localhost
. By default, this will load-test http://localhost:5000. To test a different server, run e.g:make start-locust-against-localhost LOCUST_HOST=https://labonneboite.pole-emploi.fr
(please don't do this, though). - Load the locust web interface in your browser: http://localhost:8089
- Start your swarm with for example 1 user then increase slowly and observe what happens.
- As long as your observed RPS stays coherent with your number of users, it means the app behaves correctly. As soon as the RPS is less than it shoud be and/or you get many 500 errors (check your logs) it means the load is too high or that your available bandwidth is too low.