November 9, 2021

wrk network benchmark

sudo apt-get install build-essential libssl-dev git -y
git clone https://github.com/wg/wrk.git wrk
cd wrk
sudo make
# move the executable to somewhere in your PATH, ex:
sudo cp wrk /usr/local/bin

wrk -c 100 http://127.0.0.1:8080 --latency -t 10 -d 1m

typical output

Running 1m test @ http://127.0.0.1:8200/metrics
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    28.93ms    7.77ms 186.59ms   90.80%
    Req/Sec   344.97     47.95   440.00     89.60%
  Latency Distribution
     50%   27.11ms
     75%   28.83ms
     90%   33.92ms
     99%   62.38ms
  196344 requests in 1.00m, 17.94GB read
  Socket errors: connect 0, read 0, write 0, timeout 100
Requests/sec:   3269.03
Transfer/sec:    305.87MB

command-line options

-c, --connections: total number of HTTP connections to keep open with
                   each thread handling N = connections/threads

-d, --duration:    duration of the test, e.g. 2s, 2m, 2h

-t, --threads:     total number of threads to use

-s, --script:      LuaJIT script, see SCRIPTING

-H, --header:      HTTP header to add to request, e.g. "User-Agent: wrk"

    --latency:     print detailed latency statistics

    --timeout:     record a timeout if a response is not received within
                   this amount of time.