2025-03-14 21:59:59 -06:00
|
|
|
# locust
|
|
|
|
|
|
|
|
|
|
> Load-testing tool to determine number of concurrent users a system can handle.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://docs.locust.io/en/stable/configuration.html#configuration>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Load-test "example.com" with web interface using locustfile.py:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Use a different test file:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}} {{[-f|--locustfile]}} {{test_file.py}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Run test without web interface, spawning 1 user a second until there are 100 users:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}} --headless {{[-u|--users]}} 100 {{[-r|--spawn-rate]}} 1`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Start Locust in master mode:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}} --master`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Connect Locust worker to master:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}} --worker`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Connect Locust worker to master on a different machine:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`locust {{[-H|--host]}} {{http://example.com}} --worker --master-host {{master_hostname}}`
|