wrk HTTP load tester
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
wrk -t2 -c20 -d10s <url>
wrk -t12 -c400 -d30s <url>
wrk --latency <url>
wrk -H "<header>" <url>
wrk -s <script.lua> <url>
wrk --timeout 5s <url>
wrk -c<N> -t<N> -d<time>
wrk -s <script.lua> <url> -- <args>
Concepts
- setup once per thread
- init per thread, gets args
- request / response every call
- done final summary
Running a test
wrk -t<n> -c<n> -d<time>
<url>
-t, --threads <n>
-c, --connections <n>
-d, --duration <time>
--latency--timeout <time>
-H, --header "<name: value>"
-s, --script <file>
-- <arg>...
-v, --versionReading output
| Line | Meaning |
|---|---|
| Latency | Per-request time: avg, stdev, max |
| Req/Sec | Per-thread rate, not total |
| Requests/sec | Total throughput |
| Transfer/sec | Bytes read per second |
| Socket errors | connect/read/write/timeout counts |
| Non-2xx or 3xx | Responses with error status |
Lua scripting
wrk.method = "POST"
wrk.body = '<data>'
wrk.headers["<name>"] =
"<value>"
wrk.path / wrk.host / wrk.port
function request()
wrk.format(method, path, headers, body)
function response(status, headers, body)
function init(args)
function setup(thread)
function done(summary, latency, requests)
function delay()
latency:percentile(99.0)
summary.errors.timeout
thread:set("<k>", v) /
thread:get("<k>")
Recipes
wrk -t4 -c100 -d30s --latency http://localhost:8080/
wrk.method = "POST"wrk.body = '{"name":"x"}'wrk.headers["Content-Type"] = "application/json"# wrk -t2 -c20 -d10s -s post.lua http://localhost:8080/items
counter = 0request = function() counter = counter + 1 return wrk.format("GET", "/item/" .. counter)end
response = function(status, headers, body) if status ~= 200 then print(status) endend



