wg / wrk

Modern HTTP benchmarking tool
Other
38.12k stars 2.95k forks source link

Wrk should execute the script N times instead of N + 1 times. #479

Open tonytonyjan opened 3 years ago

tonytonyjan commented 3 years ago

I found an extreme weird behavior when checking how many times wrk would execute the script:

When reading script from file, it executes 2 times, which is unexpected:

bash-3.2$ cat clock.lua
print(os.clock())

bash-3.2$ wrk -s clock.lua -t 1 https://example.com
0.004581
0.011374
Running 10s test @ https://example.com
  1 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   133.24ms    7.33ms 316.11ms   98.47%
    Req/Sec    74.74     20.84   101.00     64.89%
  720 requests in 10.05s, 1.10MB read
Requests/sec:     71.63
Transfer/sec:    112.26KB

When using process substitution by <(), it only execute once, which is expected.

bash-3.2$ wrk -s <(echo 'print(os.clock())') -t 1 https://example.com
0.004722
Running 10s test @ https://example.com
  1 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   134.98ms    4.66ms 153.82ms   84.18%
    Req/Sec    73.72     18.29   101.00     71.28%
  708 requests in 10.01s, 1.08MB read
Requests/sec:     70.70
Transfer/sec:    110.68KB

Environment