hey - HTTP load generator
hey [-n requests] [-c concurrency] [-q qps] [-z duration] [-m method] [-t timeout] url
Options you will use
-n- Requests (default 200).
-c- Concurrent workers (default 50).
-z- Run for a duration instead, e.g. -z 30s.
-q- Rate limit per worker.
-t- Per-request timeout in seconds (default 20, 0 = none).
-m- Method.
-n N- Number of requests to run (default 200).
-c N- Number of workers to run concurrently (default 50). Total requests cannot be smaller than the concurrency level.
-q QPS- Rate limit, in queries per second, per worker (default none).
-z DURATION- Duration of application to send requests, e.g. -z 30s or -z 3m. When set, -n is ignored.
-m METHOD- HTTP method: GET, POST, PUT, DELETE, HEAD, OPTIONS.
-t SECONDS- Timeout for each request in seconds (default 20, 0 = infinite).
-H HEADER- Custom HTTP header, repeatable: -H "Accept: text/html".
-d BODY- HTTP request body.
-D FILE- HTTP request body from a file.
-T TYPE- Content-type (default "text/html").
-o FORMAT- Output type: csv gives every response in CSV (default: the summary).
--disable-keepalive- Disable keep-alive: a new TCP connection per request.
Examples
$ hey -n 2000 -c 50 http://localhost:8080/api/orders$ hey -z 30s -c 50 -m POST http://localhost:8080/api/checkout &Run it in the background and take thread dumps while it runs.
Gotchas
- A closed-loop generator: each worker waits for a response before sending the next request. When the server slows down, hey sends less - it measures latency, it does not model a real crowd.
- A request hey gives up on (-t) keeps running on the server.
Taught in
Try hey in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.