0.0.2 • Published 10 years ago
wrkbl v0.0.2
wrkbl rek-ing bawl
Easy-to-use HTTP benchmarking tool for Node.js, embeddable into your app.
Inspired by wrk
Status
Currently this project is still just a prototype. But fully working, so give it a try ;)
Features
- node.js only
- embeddable interface for node.js apps
- easy-to-use binary
- multi-agent support (using multiple processes)
- generates graphs (with gnuplot)
- supports JSON configuration and multiple endpoints to bench
Install
$ npm install wrkbl
CLI Usage
$ wrkbl --agents 10 --connections 500 --duration 10s http://localhost:8000/
Usage:
wrkbl [OPTIONS] [ARGS]
Options:
-c, --connections NUMBER Connections to keep open
-d, --duration STRING Test duration
-a, --agents [NUMBER] Number of agents (Default is 1)
-H, --headers STRING Request header to be send
-m, --method [STRING] Request method (Default is GET)
-j, --json PATH JSON configuration file
--loadtest Run 5 tests (each 10s) from 10 to 2000 connections
--graph Generate graph (gnuplot is required)
-h, --help Display help and usage details
Example CLI output
Running test #1 @ http://localhost:8080/
10000ms, 10 agent(s), 200 connection(s)
Done 11068 requests in 10004ms
Latency:
Min 83.56ms
Avg 178.08ms
Max 3280.03ms
Avg 75% 97.85ms
Avg 90% 106.04ms
Avg 99% 150.5ms
HTTP response codes:
404 11068x
Requests/sec: 1106.36
Module usage
wrkbl
is also usable as a node.js module within your app or your automated test. (graphs and loadtest
option are not supported).
require('wrkbl')({
url: 'http://localhost:8080/',
duration: 2000,
connection: 10,
agents: 5
}, function (err, results) {
console.log(results);
});
will output:
{ concurrency: 10,
agents: 5,
requestsPerSecond: 1898.1,
requests: 3800,
statusCodes: { '404': 3800 },
errors: {},
duration: 2002,
latency:
{ min: 1.16,
max: 101.65,
avg: 4.71,
avg50p: 2.91,
avg75p: 3.32,
avg90p: 3.81,
avg95p: 4.07,
avg99p: 4.39 } }
Example JSON configuration
This will run --loadtest
on both servers and will generate a graph for each load test. When 2 or more graphs are generated, wrkbl
also generates a 'combied' graph.
$ wrkbl -j tests.json
[{
"name": "expressj",
"url": "http://localhost:3000/",
"loadtest": true,
"graph": true
}, {
"name": "nginx",
"url": "http://localhost:8080/",
"loadtest": true,
"graph": true
}]
Graphs (with gnuplot)
You will need gnuplot
on your machine, on Mac you can run:
$ brew install gnuplot