Distributed Locust Load Testing on Local Machine
I Was Wondering Is It Possible to Run Locust Distributed on the Local Machine? I Mean to Create Slaves and Master Locally. I Tried Next: Master: > Locust...
I was wondering is it possible to run locust distributed on the local machine? I mean to create slaves and master locally. I tried next:
Master:
> locust --master
Slaves:
> locust --slave --master-host=127.0.0.1 --master-port=8089
But I am getting the error:
You are running in distributed mode but have no slave servers connected. Please connect slaves prior to swarming.
1 Answer
Yes, it is possible to run locust distributed on the local machine. Note that you don't need to provide master-host parameter as it defaults to 127.0.0.1.
First, open the terminal and start the master using this command:
locust -f load_test_script.py --master
Then start slaves, each in a new terminal window:
locust -f load_test_script.py --worker
For optimal performance, the number of slaves on the local machine should not excide the number of CPU cores. Check official documentation for more info about running locust in distributed mode.