Locust
Python-based load testing with distributed execution. Define user behaviour in code and scale across multiple machines.
Overview
Locust, created in 2009, is an open-source load testing tool written in Python. Unlike JMeter or Gatling which use declarative test definitions, Locust lets you write user behaviour as Python code. This makes it extremely flexible — you can generate dynamic data, call external APIs, query databases, and implement complex logic directly in your test scripts.
Locust uses a master-slave architecture for distributed load testing. A single Locust master can coordinate thousands of slave nodes, each running Python processes that simulate users.
What it's used for
Locust is ideal when:
- Python team: Tests are Python code, fitting naturally into Python projects.
- Complex user behaviour: Dynamic data generation, conditional logic, and external API calls in tests.
- Distributed load testing needed: Scale across multiple machines with simple master-slave setup.
- Custom integrations required: Connect to databases, message queues, or internal systems during tests.
Pros & Cons
Pros
- Python code — full programming power in test scripts
- Simple distributed testing with master-slave architecture
- Web UI for real-time monitoring during test execution
- Extensible via Python libraries (requests, SQLAlchemy, etc.)
- Free and open source (MIT licence)
Cons
- Python only — not suitable for Java or JavaScript teams
- Single-threaded per process — needs more processes for high concurrency
- No built-in GUI for test creation
- Smaller ecosystem than JMeter
- Less efficient resource usage than Go-based k6 or Scala-based Gatling
Platforms & Integrations
Locust runs on Windows, macOS, and Linux. It requires Python 3.7+. Distributed testing is supported natively.
Pricing
| Tier | Cost | Includes |
|---|---|---|
| Open Source | Free | Full framework, distributed testing, web UI |
NZ Context
Locust is popular among NZ Python-heavy teams, particularly in data science and backend-focused companies. Rocket Lab (NZ-founded aerospace company) has used Python-based tooling for internal systems testing. For NZ teams already using Python for backend development, Locust is a natural choice for load testing.
Alternatives
- k6 — JavaScript-based. Better performance per machine.
- JMeter — GUI-based. Better for non-programming testers.
- Gatling — More efficient for high-concurrency web scenarios.