WRK CHEAT SHEET

Modern HTTP Benchmarking Tool
v1.0
Installation
  • brew install wrkmacOS
  • apt install wrkUbuntu/Debian
  • yum install wrkCentOS/RHEL
  • git clone + makeFrom source
Basic Syntax
# Basic usage pattern wrk -t12 -c400 -d30s http://example.com/api # With script wrk -t4 -c100 -d60s -s script.lua http://example.com # With custom headers wrk -t2 -c50 -d10s -H "Authorization: Bearer token" http://api.com
CLI Options
  • -t, --threadsThread count
  • -c, --connectionsOpen connections
  • -d, --durationTest duration
  • -s, --scriptLua script path
  • -H, --headerAdd HTTP header
  • --latencyPrint latency stats
  • --timeoutSocket timeout
Output Metrics
  • LatencyAvg, Stdev, Max
  • Req/SecRequests per second
  • Transfer/secData throughput
  • Socket errorsConnect, read, write
  • Non-2xx/3xxError responses
Lua Script Hooks
  • setup(thread)Thread init
  • init(args)Per-thread init
  • request()Generate request
  • response()Handle response
  • done()Test complete
Duration Formats
  • 30s30 seconds
  • 5m5 minutes
  • 1h1 hour
  • 2m30s2 min 30 sec
Lua Script: POST Request
-- post.lua - POST with JSON body wrk.method = "POST" wrk.body = '{"user":"test","pass":"123"}' wrk.headers["Content-Type"] = "application/json" function request() return wrk.format(nil, "/api/login") end
Common Examples
# Basic GET test (12 threads, 400 connections, 30 seconds) wrk -t12 -c400 -d30s http://localhost:8080/ # Detailed latency distribution wrk -t4 -c100 -d60s --latency http://api.example.com # With auth header wrk -t2 -c50 -H "Authorization: Bearer abc123" http://api.com/users # Using Lua script for dynamic requests wrk -t4 -c200 -d2m -s random_paths.lua http://example.com
Lua Script: Random URLs
-- random_paths.lua - Rotate through URLs local paths = {"/api/users", "/api/products", "/api/orders"} local counter = 0 function request() counter = counter + 1 local path = paths[(counter % #paths) + 1] return wrk.format(nil, path) end
Best Practices
  • threads ≤ coresMatch CPU cores
  • connections > threadsMultiple per thread
  • Warm up firstRun short test first
  • Use --latencyFor percentiles
Thread Recommendations
  • 2 cores-t2 -c100
  • 4 cores-t4 -c200
  • 8 cores-t8 -c400
  • 16 cores-t12 -c800

Read a results file — free, in your browser

Open a JMeter .jtl, k6 JSON or Gatling simulation.log and get the report.

All 51 cheat sheets

Free to read and free to print — no signup. Want them as A4 PDFs you can print? Get all 51 as a PDF bundle for £14.99.
A Martkos IT reference sheet · Blog · Free tools