artillery
The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
Top Related Projects
Quick Overview
Artillery is an open-source, modern, powerful, and easy-to-use load testing and functional testing toolkit. It allows developers and QA professionals to create and run complex test scenarios to simulate real-world load on their applications and APIs. Artillery supports various protocols and can be easily integrated into CI/CD pipelines.
Pros
- Highly extensible and customizable with plugins and custom JavaScript functions
- Supports multiple protocols including HTTP, WebSocket, and Socket.io
- Easy-to-read YAML configuration for defining test scenarios
- Integrates well with CI/CD pipelines and cloud platforms
Cons
- Learning curve for advanced features and custom scenarios
- Limited built-in reporting capabilities compared to some commercial alternatives
- May require additional setup for distributed load testing
- Documentation could be more comprehensive for some advanced use cases
Code Examples
- Basic HTTP GET request:
config:
target: "https://api.example.com"
phases:
- duration: 60
arrivalRate: 5
scenarios:
- flow:
- get:
url: "/users"
- POST request with payload:
config:
target: "https://api.example.com"
scenarios:
- flow:
- post:
url: "/login"
json:
username: "testuser"
password: "password123"
- WebSocket scenario:
config:
target: "wss://echo.websocket.org"
phases:
- duration: 30
arrivalRate: 10
scenarios:
- engine: "ws"
flow:
- send: "Hello, WebSocket!"
- think: 1
- send: "Goodbye, WebSocket!"
Getting Started
To get started with Artillery:
-
Install Artillery globally:
npm install -g artillery
-
Create a YAML file (e.g.,
test.yml
) with your test scenario:config: target: "https://api.example.com" phases: - duration: 60 arrivalRate: 5 scenarios: - flow: - get: url: "/users"
-
Run the test:
artillery run test.yml
This will execute a simple load test against the specified API endpoint for 60 seconds with 5 new virtual users per second.
Competitor Comparisons
Write scalable load tests in plain Python 🚗💨
Pros of Locust
- Python-based, allowing for more complex scripting and custom logic
- Distributed load testing capability out of the box
- Real-time web interface for monitoring and adjusting tests
Cons of Locust
- Steeper learning curve for non-Python developers
- Less built-in support for various protocols compared to Artillery
- Can be more resource-intensive, especially for large-scale tests
Code Comparison
Locust example:
from locust import HttpUser, task, between
class WebsiteUser(HttpUser):
wait_time = between(1, 5)
@task
def index_page(self):
self.client.get("/")
Artillery example:
config:
target: "http://example.com"
phases:
- duration: 60
arrivalRate: 5
scenarios:
- flow:
- get:
url: "/"
Both Locust and Artillery are powerful load testing tools, but they cater to different user preferences and use cases. Locust offers more flexibility and control through Python scripting, while Artillery provides a simpler YAML-based configuration for quick setup and execution of load tests.
A modern load testing tool, using Go and JavaScript - https://k6.io
Pros of k6
- Built-in support for distributed testing and cloud execution
- More extensive metrics and visualization options through Grafana integration
- Better performance for high-volume tests due to Go implementation
Cons of k6
- Steeper learning curve, especially for those unfamiliar with JavaScript
- Less extensible compared to Artillery's plugin system
- Limited support for protocols other than HTTP(S)
Code Comparison
k6:
import http from 'k6/http';
import { check } from 'k6';
export default function() {
let res = http.get('https://test.k6.io');
check(res, { 'status was 200': (r) => r.status == 200 });
}
Artillery:
config:
target: "https://artillery.io"
phases:
- duration: 60
arrivalRate: 5
scenarios:
- flow:
- get:
url: "/"
Both k6 and Artillery are popular load testing tools with their own strengths. k6 excels in high-performance scenarios and offers deep integration with Grafana for visualization. Artillery, on the other hand, provides a more accessible YAML-based configuration and a wider range of protocol support through its plugin system. The choice between the two often depends on specific project requirements, team expertise, and the desired level of customization and scalability.
HTTP load testing tool and library. It's over 9000!
Pros of Vegeta
- Written in Go, offering high performance and easy deployment
- Simple CLI interface for quick load testing
- Supports HTTP/2 out of the box
Cons of Vegeta
- Limited scripting capabilities compared to Artillery
- Fewer built-in reporting options
- Less extensive documentation and community support
Code Comparison
Artillery (JavaScript):
module.exports = {
scenarios: [{
flow: [
{ get: { url: "/api/users" } },
{ think: 3 },
{ post: { url: "/api/comments", json: { text: "Hello" } } }
]
}]
};
Vegeta (Go):
rate := vegeta.Rate{Freq: 100, Per: time.Second}
duration := 30 * time.Second
targeter := vegeta.NewStaticTargeter(vegeta.Target{
Method: "GET",
URL: "http://example.com/api/users",
})
attacker := vegeta.NewAttacker()
results := attacker.Attack(targeter, rate, duration, "Example")
Artillery offers a more declarative approach with scenario-based testing, while Vegeta provides a programmatic API for creating and executing load tests. Artillery's configuration is more human-readable, but Vegeta's code allows for more fine-grained control over test execution.
Modern Load Testing as Code
Pros of Gatling
- Scala-based DSL allows for more complex and flexible test scenarios
- Built-in support for real-time metrics and reporting
- Better performance for high-load testing scenarios
Cons of Gatling
- Steeper learning curve, especially for those unfamiliar with Scala
- Less straightforward setup process compared to Artillery
- Limited plugin ecosystem
Code Comparison
Gatling (Scala):
scenario("My Scenario")
.exec(http("Request")
.get("/api/users")
.check(status.is(200)))
.pause(5)
Artillery (JavaScript):
scenario("My Scenario", [
{ get: { url: "/api/users" } },
{ think: 5 }
]);
Both Gatling and Artillery are powerful load testing tools, but they cater to different user needs. Gatling offers more advanced features and better performance for complex scenarios, while Artillery provides a simpler, more accessible approach for quick load tests. The choice between them depends on the specific requirements of your project and team expertise.
Modern HTTP benchmarking tool
Pros of wrk
- Extremely lightweight and fast, written in C
- Simple command-line interface for quick benchmarking
- Low resource usage, suitable for running on constrained systems
Cons of wrk
- Limited scripting capabilities compared to Artillery
- Lacks built-in support for complex scenarios and test cases
- Fewer reporting and visualization options
Code Comparison
wrk:
wrk.method = "POST"
wrk.body = '{"foo": "bar"}'
wrk.headers["Content-Type"] = "application/json"
Artillery:
config:
target: "http://example.com"
phases:
- duration: 60
arrivalRate: 10
scenarios:
- flow:
- post:
url: "/api"
json:
foo: "bar"
Summary
wrk is a lightweight, fast HTTP benchmarking tool ideal for quick performance tests. It excels in simplicity and raw speed but lacks advanced features. Artillery offers more comprehensive load testing capabilities, including complex scenarios, detailed reporting, and better support for API testing. wrk is best for simple benchmarks, while Artillery suits more elaborate testing needs.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Features
- Test at cloud scale. Cloud-native distributed load testing at scale, out-of-the box and for free.
- Scale out your load tests on top of AWS Lambda or AWS Fargate. No DevOps needed, zero infrastructure to set up or manage.
- Test with Playwright. Load test with real headless browsers.
- Batteries-included. 20+ integrations for monitoring, observability, and CICD.
- Test anything. HTTP, WebSocket, Socket.io, gRPC, Kinesis, and more.
- Powerful workload modeling. Emulate complex user behavior with request chains, multiple steps, transactions, and more.
- Extensible & hackable. Artillery has a plugin API to allow extending and customization.
License
- Most of the code in this repository is licensed under the terms of the MPL 2.0 license.
- Some Azure-specific modules are licensed under the terms of the BSL license. See LICENSE-BSL.txt for details. You may use Artillery on Azure for evaluation and proof-of-concept purposes, but commercial and/or production usage requires a commercial license.
â Learn more
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot