Locust
Python-based load testing tool with code-as-test scenarios.
Pricing
Free / Open source
Type
Automation
Languages
Python
// VERDICT
Reach for Locust when you want to write load scenarios as Python code, scale out across workers easily, and watch a live web UI. Skip it when you want a GUI (JMeter), a different language (k6/Gatling), or maximum single-machine throughput.
Best for
Defining load tests as plain Python - user behaviour is ordinary code, with an easy distributed mode and a live web UI, ideal for Python teams who want flexible, scriptable load.
Avoid when
You want a GUI/record tool, a non-Python language, or the absolute highest single-node throughput.
CI/CD fit
Locust CLI (headless) · GitHub Actions · GitLab CI · Jenkins · distributed workers
Languages
Python
Team fit
Python teams · Developer-owned load testing · Teams wanting code-defined user behaviour
Setup
Maintenance
Learning
Licence
// BEST FOR
- Writing load scenarios as ordinary Python code
- An easy distributed mode (master + workers) to scale load
- A live web UI showing requests, failures and response times
- Flexible user behaviour with full programming-language power
- Python teams wanting load tests in their own stack
- Headless runs in CI alongside the interactive UI
// AVOID WHEN
- You want a GUI / record-and-playback tool (JMeter)
- Your team doesn't work in Python
- You need maximum throughput from a single node (wrk/Gatling)
- A managed enterprise platform is required (LoadRunner/NeoLoad)
- You want a non-code, business-tester-friendly tool
- You only need a quick one-off HTTP benchmark (wrk/Vegeta)
// QUICK START
pip install locust
# locustfile.py: class User(HttpUser) with @task methods
locust -f locustfile.py # web UI, or --headless -u 100 -r 10 in CI// ALTERNATIVES TO CONSIDER
| Tool | Choose it when |
|---|---|
| k6 | You want JS-based load tests with a high-performance engine. |
| Gatling | You want a JVM DSL with an efficient async engine. |
| Apache JMeter | You want a GUI/record-based tool with a plugin ecosystem. |
// FEATURES
- Python user-behaviour scripts
- Distributed master/worker mode
- Web UI for live results
- Event-driven via gevent
- Custom protocol support via plugins
// PROS
- Easy to adopt for Python teams
- Real Python code, not a DSL
- Distributed scaling is straightforward
- Live web UI is friendly for stakeholders
// CONS
- Lower per-worker performance than k6 or Gatling
- Reporting less detailed out of the box
- GIL limits single-process throughput
// EXAMPLE QA WORKFLOW
Install Locust (pip)
Write a locustfile with user tasks in Python
Model realistic wait times and behaviour
Run with the web UI to explore, or headless for CI
Scale with master/worker processes for higher load
Gate CI on failure/threshold criteria
// RELATED QA.CODES RESOURCES
Cheat sheets
Practice