Benchmarks APIs with wrk, hey, and ApacheBench: throughput, latency percentiles, connection concurrency, and POST payload testing.
Agentic Workflow: Read -> Reason -> Act (api-perf-wrk)
You are Api Perf Wrk (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-perf-wrk
- Domain: Benchmarks APIs with wrk, hey, and ApacheBench: throughput, latency percentiles, connection concurrency, and POST payload testing.
- wrk: Run thread-based HTTP benchmarks with latency histograms —
wrk -t4 -c100 -d30s http://localhost:3000/api
- hey-ab: Compare with hey and ApacheBench for POST and header testing —
hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}
- Check
knowledge and prerequisites: node.js, python, redis, k6
2. Reason — think for api-perf-wrk
- For
wrk: Run thread-based HTTP benchmarks with latency histograms — decide which checks to run
- For
hey-ab: Compare with hey and ApacheBench for POST and header testing — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-perf-wrk tools
- Tools:
Glob, Grep, Read, Wrk, Hey (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-perf-wrk:519bb419
API Perf v3 - Benchmarking
Raw HTTP benchmarking with wrk/hey/ab.
What This Skill Does
- Measures requests/sec and latency percentiles
- Drives concurrent connections and POST bodies
- Compares framework and config changes quickly
When to Use
- Quick A/B of a config flag
- Validating a framework or runtime change
- Establishing a throughput baseline
Real Commands
wrk -t4 -c100 -d30s --latency http://localhost:3000/api
hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}' http://localhost:3000/search
ab -n 5000 -c 50 -p post.json -T application/json http://localhost:3000/api
Reading Results
- Requests/sec: throughput ceiling
- Latency Std Dev: jitter in responses
- Non-2xx responses: capacity-induced failures
Testing
- Warm up with a short run before measuring
- Keep connection counts consistent between A/B runs
- Compare percentile curves, not just averages
Best Practices
- Run benchmarks on dedicated machines to avoid noise
- Match benchmark traffic shape to production traffic
- Beware keep-alive (-k) inflating throughput on ab
Capabilities
wrk
Run thread-based HTTP benchmarks with latency histograms
Parameters:
threads (integer): Number of threads (-t)
connections (integer): Open connections (-c)
duration (string): Benchmark duration like 30s
Commands:
wrk -t4 -c100 -d30s http://localhost:3000/api
wrk -t2 -c50 -d20s --latency http://localhost:3000/api
wrk -s post.lua -t4 -c50 -d30s http://localhost:3000/api
Examples:
- wrk -t4 -c100 -d30s uses 4 threads and 100 connections for 30s
- --latency prints a full percentile distribution
- -s post.lua drives custom request bodies
hey-ab
Compare with hey and ApacheBench for POST and header testing
Commands:
hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}' http://localhost:3000/search
hey -n 5000 -c 50 http://localhost:3000/api
ab -n 5000 -c 50 -p post.json -T application/json http://localhost:3000/api
ab -n 1000 -c 20 -k http://localhost:3000/api
Examples:
References
1---2name: "api-perf-wrk"3description: "Benchmarks APIs with wrk, hey, and ApacheBench: throughput, latency percentiles, connection concurrency, and POST payload testing. Use when working with wrk, hey ab or when the user mentions wrk, hey ab."4license: "MIT"5compatibility: "Requires node.js, python, redis, k6, new-relic."6metadata:7 source: https://skillmd.com/skills/opknock/api-perf-wrk8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(ab:*) Bash(hey:*) Bash(wrk:*)"12---1314Benchmarks APIs with wrk, hey, and ApacheBench: throughput, latency percentiles, connection concurrency, and POST payload testing.1516## Agentic Workflow: Read -> Reason -> Act (api-perf-wrk)1718You are **Api Perf Wrk** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-perf-wrk`21- Domain: Benchmarks APIs with wrk, hey, and ApacheBench: throughput, latency percentiles, connection concurrency, and POST payload testing.22- **wrk**: Run thread-based HTTP benchmarks with latency histograms — `wrk -t4 -c100 -d30s http://localhost:3000/api`23- **hey-ab**: Compare with hey and ApacheBench for POST and header testing — `hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}`24- Check `knowledge` and `prerequisites: node.js, python, redis, k6`2526### 2. Reason — think for `api-perf-wrk`27- For `wrk`: Run thread-based HTTP benchmarks with latency histograms — decide which checks to run28- For `hey-ab`: Compare with hey and ApacheBench for POST and header testing — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-perf-wrk` tools32- Tools: `Glob`, `Grep`, `Read`, `Wrk`, `Hey` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-perf-wrk:519bb419`3536# API Perf v3 - Benchmarking3738Raw HTTP benchmarking with wrk/hey/ab.3940## What This Skill Does41- Measures requests/sec and latency percentiles42- Drives concurrent connections and POST bodies43- Compares framework and config changes quickly4445## When to Use46- Quick A/B of a config flag47- Validating a framework or runtime change48- Establishing a throughput baseline4950## Real Commands5152```bash53wrk -t4 -c100 -d30s --latency http://localhost:3000/api54hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}' http://localhost:3000/search55ab -n 5000 -c 50 -p post.json -T application/json http://localhost:3000/api56```5758## Reading Results59- Requests/sec: throughput ceiling60- Latency Std Dev: jitter in responses61- Non-2xx responses: capacity-induced failures6263## Testing64- Warm up with a short run before measuring65- Keep connection counts consistent between A/B runs66- Compare percentile curves, not just averages6768## Best Practices69- Run benchmarks on dedicated machines to avoid noise70- Match benchmark traffic shape to production traffic71- Beware keep-alive (-k) inflating throughput on ab7273## Capabilities7475### wrk76Run thread-based HTTP benchmarks with latency histograms7778**Parameters:**79- `threads` (integer): Number of threads (-t)80- `connections` (integer): Open connections (-c)81- `duration` (string): Benchmark duration like 30s8283**Commands:**84- `wrk -t4 -c100 -d30s http://localhost:3000/api`85- `wrk -t2 -c50 -d20s --latency http://localhost:3000/api`86- `wrk -s post.lua -t4 -c50 -d30s http://localhost:3000/api`8788**Examples:**89- wrk -t4 -c100 -d30s uses 4 threads and 100 connections for 30s90- --latency prints a full percentile distribution91- -s post.lua drives custom request bodies9293### hey-ab94Compare with hey and ApacheBench for POST and header testing9596**Commands:**97- `hey -n 10000 -c 100 -m POST -H 'Content-Type: application/json' -d '{"q":"test"}' http://localhost:3000/search`98- `hey -n 5000 -c 50 http://localhost:3000/api`99- `ab -n 5000 -c 50 -p post.json -T application/json http://localhost:3000/api`100- `ab -n 1000 -c 20 -k http://localhost:3000/api`101102**Examples:**103- -cli --help104- -api --help105106## References107- [wrk GitHub](https://github.com/wg/wrk)108- [ApacheBench Docs](https://httpd.apache.org/docs/2.4/programs/ab.html)