artillery, k6, and loadtest are tools designed to simulate user traffic and measure the performance of web applications under stress. artillery is a modern, open-source load testing toolkit built on Node.js, known for its YAML-based configuration and support for complex scenarios including WebSockets and gRPC. k6 is a developer-centric load testing tool written in Go but scriptable in JavaScript, focusing on high performance, CI/CD integration, and detailed metrics collection. loadtest is a lightweight, older Node.js utility for running simple HTTP load tests directly from the command line or code, best suited for quick, basic sanity checks rather than complex performance engineering.
When your Node.js application starts gaining users, guessing its limits isn't an option. You need to know how it behaves under pressure. artillery, k6, and loadtest all aim to solve this, but they take very different approaches. One is a modern, extensible platform; another is a high-performance engine built for automation; and the third is a legacy utility for quick checks. Let's break down how they work in real engineering scenarios.
How you write your test matters. It dictates how easy it is to maintain, share, and version control your performance strategy.
artillery shines with its YAML-first approach. You define your flow in a declarative file, which makes it easy for non-developers to read. However, you can drop into JavaScript for complex logic.
# artillery: config.yml
config:
target: "https://api.example.com"
phases:
- duration: 60
arrivalRate: 10
scenarios:
- name: "Get User Profile"
flow:
- get:
url: "/users/123"
capture:
- json: "$.id"
as: "userId"
- post:
url: "/users/{{ userId }}/settings"
json:
theme: "dark"
k6 uses standard JavaScript (ES6) for everything. This feels natural to frontend and backend developers alike. You write code, import modules, and handle logic just like in your app.
// k6: script.js
import http from 'k6/http';
import { check, sleep } from 'k6';
export let options = {
vus: 50,
duration: '60s',
};
export default function () {
let res = http.get('https://api.example.com/users/123');
check(res, {
'status is 200': (r) => r.status === 200,
'body has ID': (r) => r.json('id') !== null,
});
sleep(1);
}
loadtest is strictly a command-line tool or a simple function call. You don't write "scenarios" in a file; you pass flags to a binary or call a function with options. It lacks a structured definition language.
# loadtest: CLI usage
npx loadtest -c 10 -n 100 -t 5000 https://api.example.com/users/123
// loadtest: Programmatic usage
const loadtest = require('loadtest');
loadtest.loadTest({
url: 'https://api.example.com/users/123',
concurrency: 10,
maxRequests: 100,
requestTimeout: 5000,
}, (error, results) => {
console.log('Mean latency:', results.meanLatencyMs);
});
Real users don't just hit one URL. They log in, get a token, and use that token to fetch data. Handling this "state" is where tools separate themselves.
artillery handles this with built-in capture and expect blocks. It automatically manages cookies and lets you extract data from one response to use in the next request seamlessly.
# artillery: Capturing dynamic data
flow:
- post:
url: "/login"
json:
user: "alice"
pass: "secret"
capture:
- json: "$.token"
as: "authToken"
- get:
url: "/profile"
headers:
Authorization: "Bearer {{ authToken }}"
k6 gives you full control via JavaScript variables. You parse the response, store the value in a variable, and use it in the next request. This is flexible but requires you to write the parsing logic.
// k6: Manual state management
import http from 'k6/http';
export default function () {
// Login
let loginRes = http.post('https://api.example.com/login', {
user: 'alice',
pass: 'secret'
});
let token = loginRes.json('token');
// Use token in next request
let headers = { Authorization: `Bearer ${token}` };
let profileRes = http.get('https://api.example.com/profile', { headers });
}
loadtest does not support multi-step flows or state capture natively. It fires independent requests. If you need to pass a token from one request to another, you have to write complex custom code outside the tool's main loop, which defeats its purpose as a simple utility. It is effectively unable to handle realistic user journeys without significant hacking.
// loadtest: No native support for chained requests
// You can only send independent requests with static headers.
// Simulating a login -> fetch flow is not feasible with standard API.
const options = {
url: 'https://api.example.com/profile',
headers: { 'Authorization': 'Bearer STATIC_TOKEN_ONLY' } // Cannot dynamic update
};
Modern apps use more than just REST over HTTP. They use WebSockets for chat, gRPC for microservices, and Socket.io for real-time features.
artillery has first-class support for these protocols. You can switch engines in your config to test WebSockets or Socket.io without changing tools.
# artillery: WebSocket support
config:
target: "ws://chat.example.com"
phases: [{ duration: 30, arrivalRate: 5 }]
scenarios:
- engine: "ws"
flow:
- send: "join_room"
payload: "{ \"room\": \"general\" }"
- think: 2
- send: "ping"
k6 supports WebSockets and gRPC through specific imports. While not as declarative as Artillery's YAML, it provides robust APIs for these protocols within the JavaScript environment.
// k6: WebSocket support
import ws from 'k6/ws';
export default function () {
let url = 'ws://chat.example.com';
let response = ws.connect(url, {}, function (socket) {
socket.on('open', () => {
socket.send('join_room');
});
socket.on('message', (data) => {
console.log('Received:', data);
});
socket.setTimeout(() => {
socket.close();
}, 5000);
});
}
loadtest is strictly HTTP/HTTPS. It cannot test WebSockets, gRPC, or any other protocol. If your architecture relies on real-time connections, this tool is immediately disqualified.
# loadtest: HTTP only
# No flags or options exist for ws:// or grpc:// targets
npx loadtest -c 10 https://api.example.com
The engine running your test dictates how much load you can generate from a single machine.
artillery runs on Node.js. This is great for compatibility and extending with npm packages, but Node.js is single-threaded by default. To generate massive load, you often need to run Artillery in distributed mode across multiple machines or containers.
# artillery: Running locally (limited by Node event loop)
npx artillery run test.yml
# artillery: Distributed mode requires extra setup (e.g., AWS Lambda or containers)
# npx artillery deploy ...
k6 is built on Go. The core engine is highly concurrent and efficient. It can generate significantly more load from a single instance compared to Node.js-based tools. It also has a native concept of "thresholds" to fail CI builds automatically if performance SLAs are missed.
// k6: Defining performance thresholds
export let options = {
thresholds: {
http_req_duration: ['p(95)<500'], // 95% of requests must be under 500ms
http_req_failed: ['rate<0.01'], // Error rate must be less than 1%
},
vus: 100,
duration: '1m'
};
loadtest is also Node.js-based but lacks the advanced clustering or distributed capabilities of Artillery. It is designed for low-concurrency testing. Pushing it hard will likely bottleneck your own machine's event loop before you stress the target server.
// loadtest: Concurrency is limited
// High concurrency values here may crash the runner process itself
loadtest.loadTest({
url: 'https://api.example.com',
concurrency: 50, // Risky for complex scenarios on single Node process
}, ...);
It is critical to note the maintenance status of these tools.
loadtest is effectively deprecated for modern professional use. Its last significant updates were years ago. It lacks support for modern HTTP features, has known issues with newer Node.js versions, and does not receive security patches. Do not use loadtest for new projects or critical production testing. It serves only as a historical reference or for extremely trivial, one-off checks on legacy systems.
artillery and k6 are actively maintained. Artillery focuses on developer experience and extensibility within the JS ecosystem. k6 focuses on raw performance and CI/CD integration.
| Feature | artillery | k6 | loadtest |
|---|---|---|---|
| Primary Config | YAML (with JS plugins) | JavaScript (ES6) | CLI Flags / JSON Object |
| Engine | Node.js | Go (with JS VM) | Node.js |
| Protocols | HTTP, WebSocket, Socket.io, gRPC | HTTP, WebSocket, gRPC | HTTP/HTTPS Only |
| State Management | Built-in (capture, expect) | Manual (JS variables) | Not Supported |
| CI/CD Ready | Yes (Plugins/Thresholds) | Yes (Native Thresholds) | No (Manual parsing) |
| Status | ✅ Active | ✅ Active | ⚠️ Deprecated / Legacy |
artillery is your go-to if you live in the Node.js ecosystem and need to test complex, real-world scenarios like WebSockets or multi-step forms without writing a ton of boilerplate code. Its YAML format makes tests readable for the whole team.
k6 is the choice for performance engineers and DevOps teams. If you need to generate heavy load from a single container, enforce strict SLAs in your CI pipeline, and write tests using standard JavaScript, k6 is superior. Its Go backend ensures it won't choke when you ramp up to thousands of users.
loadtest should be avoided for any serious architectural decision. It is a legacy tool that lacks the features, protocol support, and maintenance required for modern web applications. Stick to artillery or k6 for reliable, scalable results.
Choose artillery if you need a flexible, Node.js-native tool that supports complex protocols like WebSockets, Socket.io, and gRPC out of the box. It is ideal for teams that prefer defining test scenarios in YAML for readability or want to extend tests with custom JavaScript plugins for advanced logic and reporting.
Choose k6 if performance and scalability are your top priorities, especially in CI/CD pipelines. It is the best fit for teams who want to write tests in standard JavaScript (ES6) but require the efficiency of a Go-based engine to generate massive load without consuming excessive local resources.
Choose loadtest only for quick, ad-hoc testing of simple HTTP endpoints where installing heavy tools is overkill. It is suitable for legacy projects or simple scripts where you need to verify basic response times and throughput without complex scenarios, but avoid it for serious production load testing due to its age and limited feature set.
npm install -g artillery
Follow our 5-minute guide to run your first load test - https://www.artillery.io/docs/get-started/first-test
We maintain a list of official and community-built integrations and plugins on our website: https://www.artillery.io/integrations.
You can find a list of ready-to-run Artillery examples under examples/.