An open source load testing tool: define user behaviour in plain Python and swarm your system with millions of simultaneous users
open sourceMITself-hostablefree
Locust is an open source load testing tool where test scenarios are plain Python code: each simulated user runs in its own gevent greenlet, so a locustfile reads like ordinary blocking code and lives in version control next to the service it tests. Tests run from the command line or a web UI that shows throughput, response times and errors live, and results can be exported for later analysis. It runs distributed across many machines for hundreds of thousands of concurrent users, with a Kubernetes operator that manages master and worker jobs, and it can export traces, metrics and logs over OpenTelemetry. HTTP and HTTPS are built in; other protocols are tested by wrapping their Python client libraries. Locust is MIT-licensed and community-maintained; Microsoft sponsors its maintenance, and Azure Load Testing runs Locust tests as a managed service.
Ways to install
Package managers
Problems it solves
- load test my API by writing the user behaviour in Python instead of clicking through a GUI
- find out how many concurrent users our web app handles before response times fall apart
- keep load test scenarios in git as normal code our developers can review
- simulate hundreds of thousands of users by spreading the load across several machines
- watch requests per second, response times and failures live in a browser while the test runs
- run a headless load test in CI and fail the build when error rates go up
- reuse our existing Python libraries and test data inside a load test
- model realistic user journeys with logins, waits and conditional steps under load
- load test something that isn't HTTP, like a database or a custom TCP protocol, from Python
- run distributed load tests on Kubernetes without hand-managing master and worker pods
- correlate load test traffic with our traces and metrics in an OpenTelemetry backend
- replace our JMeter XML test plans with Python code
- free open source alternative to LoadRunner for stress testing a website
- stress test an endpoint until it breaks to find our capacity limit before a launch
- spike test a service by ramping users up quickly and back down
- run a load test from the command line with a fixed number of users and spawn rate
- export load test results to CSV for a performance report
- run Python load tests in the cloud without managing our own load generators
Features
- test scenarios written in plain Python, no GUI or XML
- each user runs in a gevent greenlet, so thousands of users per process
- distributed runs across many machines (master and workers)
- web UI with live throughput, response time and error charts
- headless command-line mode for CI
- CSV export of statistics and history
- built-in HTTP/HTTPS client (HttpUser), with FastHttpUser for higher request rates
- extensible to other protocols by wrapping Python client libraries
- Kubernetes operator with a Helm chart that manages tests as resources
- official Docker images, including one with OpenTelemetry dependencies
View 5 more
- OpenTelemetry export of traces, metrics and logs over OTLP
- can be used as a Python library from your own code
- event hooks and plugins for custom behaviour
- llms.txt and llms-full.txt for AI coding assistants
- runs on Azure Load Testing as a managed service
Limitations
- Only HTTP and HTTPS are built in: other protocols need their Python client library wrapped in your test code3
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Takes plugins | plan not known |
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Locust does.
- Gatling Modern load testing as code
- Artillery Full-stack performance and reliability testing: scalable API and Playwright load testing
- Grafana k6 Like unit testing, for performance
- Apache JMeter A 100% pure Java application designed to load test functional behavior and measure performance
- Vegeta HTTP load testing tool and library built to drill HTTP services with a constant request rate
