Assuming you have a launched.inv file prepared, as shown in the previous step, run this ansible command to start locust as a worker on all your worker nodes.
ansible-playbook startWorkers.yml -i launched.inv \
-e "victimUrl=http://YourWebSite.com masterHost=YourMasterHost"
Start the master process using the following python command.
python3 -u runLocust.py --host=http://YourWebSite.com --master \
--heartbeat-liveness=30 -f master_locust.py
Locust will print some progress and status information to the stdout as shown below. You may note the number of worker (slave) nodes that show up.
[2018-12-02 18:40:14,483] ip-172-26-4-17/INFO/locust.main: Starting web monitor at *:30002
[2018-12-02 18:40:14,484] ip-172-26-4-17/INFO/locust.main: Starting Locust 0.9.0
Now that locust is up and running on all the nodes, browse to port 30002 of your master host to control testing. You should see the front
page of the Locust UI. At the top right it shows the number of workers (slaves) it knows about. This will match the number of workers
(slaves) you started, unless something has gone wrong.
Enter a number of users to simulate. For a first test, just enter the number of workers (slaves). You could also enter a small multiple of
the number of workers (slaves) (e.g. 4X) to make the victim work harder.
Enter a number for "hatch rate", the number of simulated users spawned per second. This controls how quickly the load test ramps up at the
beginning. The ideal number depends on the system you are testing. For example, if you are simulating 1000 users but you don't want them
all showing up at the same time, enter a hatch rate of less than 1000.
Click "Start Swarming" to start the test. Locust will then show its main UI.
To stop a test, click "Stop" in the Locust web UI.
To exit the processes, use ctrl-c in the master's terminal window, or kill it with SIGINT. When shutting down, the master sends a message to all workers telling them to exit.