HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

locust — Load-testing tool to determine number of concurrent users a system can handle. More information: <ht

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandloaddetermineclitoollocustnumbertesting

Problem

How to use the locust command: Load-testing tool to determine number of concurrent users a system can handle. More information: <https://docs.locust.io/en/stable/configuration.html#configuration>.

Solution

locust — Load-testing tool to determine number of concurrent users a system can handle. More information: <https://docs.locust.io/en/stable/configuration.html#configuration>.

Load-test "example.com" with web interface using locustfile.py:
locust {{[-H|--host]}} {{http://example.com}}


Use a different test file:
locust {{[-H|--host]}} {{http://example.com}} {{[-f|--locustfile]}} {{test_file.py}}


Run test without web interface, spawning 1 user a second until there are 100 users:
locust {{[-H|--host]}} {{http://example.com}} --headless {{[-u|--users]}} 100 {{[-r|--spawn-rate]}} 1


Start Locust in master mode:
locust {{[-H|--host]}} {{http://example.com}} --master


Connect Locust worker to master:
locust {{[-H|--host]}} {{http://example.com}} --worker


Connect Locust worker to master on a different machine:
locust {{[-H|--host]}} {{http://example.com}} --worker --master-host {{master_hostname}}

Code Snippets

Load-test "example.com" with web interface using locustfile.py

locust {{[-H|--host]}} {{http://example.com}}

Use a different test file

locust {{[-H|--host]}} {{http://example.com}} {{[-f|--locustfile]}} {{test_file.py}}

Run test without web interface, spawning 1 user a second until there are 100 users

locust {{[-H|--host]}} {{http://example.com}} --headless {{[-u|--users]}} 100 {{[-r|--spawn-rate]}} 1

Start Locust in master mode

locust {{[-H|--host]}} {{http://example.com}} --master

Connect Locust worker to master

locust {{[-H|--host]}} {{http://example.com}} --worker

Context

tldr-pages: common/locust

Revisions (0)

No revisions yet.