Skip to content
Latchkey

vegeta attack and report: HTTP Load Testing

vegeta attack sends requests at a fixed rate for a duration and vegeta report turns the resulting binary results into a latency and status-code summary.

Vegeta is a constant-rate load tester: you ask for N requests per second and it holds that rate, which is ideal for measuring latency under a known load rather than just maxing out throughput.

What it does

vegeta attack reads targets (a method and URL per line, or from a file), fires them at -rate requests per second for -duration, and writes binary results. vegeta report reads those results and prints latency percentiles, throughput, and a status-code histogram.

Common usage

Terminal
echo "GET https://staging.example.com/" \
  | vegeta attack -rate=50 -duration=30s > results.bin
vegeta report results.bin
# targets from a file, plus a histogram report
vegeta attack -targets=targets.txt -rate=100 -duration=1m \
  | vegeta report -type='hist[0,10ms,50ms,100ms,500ms]'

Options

FlagWhat it does
-rate <r>Requests per second (constant rate)
-duration <d>How long to attack, e.g. 30s
-targets <file>File of request lines
-header "K: V"Add a header to every request (repeatable)
report -type=jsonMachine-readable report
report -type=hist[...]Latency histogram buckets

In CI

Pipe vegeta report -type=json to a small script (or jq) and fail the step when p99 or the success ratio crosses your SLO; vegeta itself does not exit non-zero on slow responses. Pass auth tokens with -header "Authorization: Bearer $TOKEN" from a CI secret.

Common errors in CI

"vegeta: error: no targets specified" means stdin was empty and no -targets file was given. A report full of "0" status codes means connections never completed (DNS or connection refused) rather than HTTP errors. "Success [ratio] 0.00%" with status 0 points at an unreachable host, not a slow one.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →