Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies, latency reports, and JSON output.
Agentic Workflow: Read -> Reason -> Act (autocannon)
You are Autocannon (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for autocannon
- Domain: Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies, latency reports, and JSON output.
- basic-load: Run basic load tests with configurable concurrency and duration. —
npx autocannon -c 100 -d 30 http://localhost:3000
- custom-requests: Load-test with custom methods, bodies, headers, and paths. —
npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: applic
- reporting: Capture JSON results and render reports. —
npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json
- Check
knowledge and prerequisites: npx
2. Reason — think for autocannon
- For
basic-load: Run basic load tests with configurable concurrency and duration. — decide which checks to run
- For
custom-requests: Load-test with custom methods, bodies, headers, and paths. — decide which checks to run
- For
reporting: Capture JSON results and render reports. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with autocannon tools
- Tools:
Glob, Grep, Read, Npx (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
autocannon:e44450c6
Autocannon
What this skill does
Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies/headers, latency percentiles, status-code breakdowns, and JSON results for CI.
When to use
- Quick capacity check of an endpoint
- Comparing latency before/after an optimization
- Verifying a server survives burst connections
Real commands
# Basic: 100 connections for 30s
npx autocannon -c 100 -d 30 http://localhost:3000
# With latency breakdown
npx autocannon -c 50 -d 60 --latency http://localhost:3000
# POST with JSON body
npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: application/json" http://localhost:3000/api/users
# JSON output for CI
npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json
# Extract p99
npx autocannon --json http://localhost:3000 | jq '.latency.p99'
Testing
- Run once to warm up, then record the second run
- Compare results across commits; guard on p99 regressions
Best practices
- Fix the target rate (-R) or connections (-c) for comparability
- Test with real payloads, not empty GETs
- Watch for socket errors and timeouts, not just throughput
Capabilities
basic-load
Run basic load tests with configurable concurrency and duration.
Parameters:
connections (number): Concurrent connections (-c)
duration (number): Test duration in seconds (-d)
rate (number): Fixed requests per second (-R)
Commands:
npx autocannon -c 100 -d 30 http://localhost:3000
npx autocannon -c 50 -d 60 --latency http://localhost:3000
npx autocannon -R 1000 http://localhost:3000
npx autocannon --workers 4 -c 100 -d 30 http://localhost:3000
Examples:
custom-requests
Load-test with custom methods, bodies, headers, and paths.
Parameters:
method (string): HTTP method (-m)
body (string): Request body (-b)
headers (string): Headers as -H key:value
Commands:
npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: application/json" http://localhost:3000/api/users
npx autocannon -c 50 -d 20 -H "Authorization: Bearer $TOKEN" http://localhost:3000/api/me
npx autocannon -c 10 -d 30 --body '{"q":"search"}' -m POST -H "Content-Type: application/json" http://localhost:3000/api/search
npx autocannon -c 20 -d 30 -m PUT -b '{"status":"ok"}' -H "Content-Type: application/json" http://localhost:3000/api/orders/42
Examples:
reporting
Capture JSON results and render reports.
Parameters:
json (boolean): Emit JSON output
output (string): Write results to a file
Commands:
npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json
npx autocannon --output results.json -c 100 -d 20 http://localhost:3000
npx autocannon -c 100 -d 20 http://localhost:3000 | jq '.latency'
npx autocannon -c 100 -d 20 --renderStatusCodes http://localhost:3000
Examples:
References
1---2name: "autocannon"3description: "Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies, latency reports, and JSON output. Use when working with basic load, custom requests, reporting, api or when the user mentions basic load, custom requests, reporting, api."4license: "MIT"5compatibility: "Requires npx."6metadata:7 source: https://skillmd.com/skills/opknock/autocannon8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(npx:*)"12---1314Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies, latency reports, and JSON output.1516## Agentic Workflow: Read -> Reason -> Act (autocannon)1718You are **Autocannon** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `autocannon`21- Domain: Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies, latency reports, and JSON output.22- **basic-load**: Run basic load tests with configurable concurrency and duration. — `npx autocannon -c 100 -d 30 http://localhost:3000`23- **custom-requests**: Load-test with custom methods, bodies, headers, and paths. — `npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: applic`24- **reporting**: Capture JSON results and render reports. — `npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json`25- Check `knowledge` and `prerequisites: npx`2627### 2. Reason — think for `autocannon`28- For `basic-load`: Run basic load tests with configurable concurrency and duration. — decide which checks to run29- For `custom-requests`: Load-test with custom methods, bodies, headers, and paths. — decide which checks to run30- For `reporting`: Capture JSON results and render reports. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `autocannon` tools34- Tools: `Glob`, `Grep`, `Read`, `Npx` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `autocannon:e44450c6`3738# Autocannon3940## What this skill does4142Load-tests HTTP servers with autocannon: concurrent connections, custom methods/bodies/headers, latency percentiles, status-code breakdowns, and JSON results for CI.4344## When to use4546- Quick capacity check of an endpoint47- Comparing latency before/after an optimization48- Verifying a server survives burst connections4950## Real commands5152```bash53# Basic: 100 connections for 30s54npx autocannon -c 100 -d 30 http://localhost:30005556# With latency breakdown57npx autocannon -c 50 -d 60 --latency http://localhost:30005859# POST with JSON body60npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: application/json" http://localhost:3000/api/users6162# JSON output for CI63npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json6465# Extract p9966npx autocannon --json http://localhost:3000 | jq '.latency.p99'67```6869## Testing7071- Run once to warm up, then record the second run72- Compare results across commits; guard on p99 regressions7374## Best practices7576- Fix the target rate (-R) or connections (-c) for comparability77- Test with real payloads, not empty GETs78- Watch for socket errors and timeouts, not just throughput7980## Capabilities8182### basic-load83Run basic load tests with configurable concurrency and duration.8485**Parameters:**86- `connections` (number): Concurrent connections (-c)87- `duration` (number): Test duration in seconds (-d)88- `rate` (number): Fixed requests per second (-R)8990**Commands:**91- `npx autocannon -c 100 -d 30 http://localhost:3000`92- `npx autocannon -c 50 -d 60 --latency http://localhost:3000`93- `npx autocannon -R 1000 http://localhost:3000`94- `npx autocannon --workers 4 -c 100 -d 30 http://localhost:3000`9596**Examples:**97- npx autocannon -c 100 -d 30 http://localhost:300098- npx autocannon --latency -c 20 -d 120 http://localhost:3000/api/users99- npx autocannon -c 1000 --duration 10 http://localhost:3000/health100101### custom-requests102Load-test with custom methods, bodies, headers, and paths.103104**Parameters:**105- `method` (string): HTTP method (-m)106- `body` (string): Request body (-b)107- `headers` (string): Headers as -H key:value108109**Commands:**110- `npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: application/json" http://localhost:3000/api/users`111- `npx autocannon -c 50 -d 20 -H "Authorization: Bearer $TOKEN" http://localhost:3000/api/me`112- `npx autocannon -c 10 -d 30 --body '{"q":"search"}' -m POST -H "Content-Type: application/json" http://localhost:3000/api/search`113- `npx autocannon -c 20 -d 30 -m PUT -b '{"status":"ok"}' -H "Content-Type: application/json" http://localhost:3000/api/orders/42`114115**Examples:**116- npx autocannon -c 50 -d 20 -m POST -b '{"name":"test"}' -H "Content-Type: application/json" http://localhost:3000/api/users117- npx autocannon --connections 100 -m PATCH -b '{"seen":true}' -H "Content-Type: application/json" http://localhost:3000/api/notifications/1118- npx autocannon -c 10 -d 60 -H "Accept: application/json" http://localhost:3000/api/feed119120### reporting121Capture JSON results and render reports.122123**Parameters:**124- `json` (boolean): Emit JSON output125- `output` (string): Write results to a file126127**Commands:**128- `npx autocannon --json -c 100 -d 20 http://localhost:3000 > results.json`129- `npx autocannon --output results.json -c 100 -d 20 http://localhost:3000`130- `npx autocannon -c 100 -d 20 http://localhost:3000 | jq '.latency'`131- `npx autocannon -c 100 -d 20 --renderStatusCodes http://localhost:3000`132133**Examples:**134- npx autocannon --json http://localhost:3000 | jq '{requests, latency: .latency.p99}'135136- npx autocannon --output results.json -d 30 -c 100 http://localhost:3000 && cat results.json | jq .requests137- npx autocannon --renderStatusCodes -c 50 -d 10 http://localhost:3000138139## References140- [autocannon GitHub](https://github.com/mcollina/autocannon)141- [Node.js Benchmarking Guide](https://nodejs.org/en/learn/diagnostics/simple-profiling)