Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response hook in script slows down the benchmark #506

Open
charz opened this issue Jan 16, 2023 · 0 comments
Open

Response hook in script slows down the benchmark #506

charz opened this issue Jan 16, 2023 · 0 comments

Comments

@charz
Copy link

charz commented Jan 16, 2023

Just curious if anyone noticed if we put response (https://github.com/wg/wrk/blob/master/scripts/setup.lua#L26-L28) hook in lua script, that slows down the benchmark.

With Script

$ ./wrk -c 4 -t 2 -d 60 --timeout 300 -s scripts/setup.lua https://test.io/1GB.data
thread 1 created
thread 2 created
Running 1m test @ https://test.io/1GB.data
  2 threads and 4 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     0.00us    0.00us   0.00us    -nan%
    Req/Sec     0.00      0.00     0.00      -nan%
  0 requests in 1.00m, 0.98GB read
Requests/sec:      0.00
Transfer/sec:     16.72MB
thread 1 made 3 requests and got 0 responses
thread 2 made 2 requests and got 0 responses

Script without response function()

$ git diff scripts/setup.lua
diff --git a/scripts/setup.lua b/scripts/setup.lua
index 30d72f3..e3b2689 100644
--- a/scripts/setup.lua
+++ b/scripts/setup.lua
@@ -23,9 +23,9 @@ function request()
    return wrk.request()
 end

-function response(status, headers, body)
-   responses = responses + 1
-end
+--function response(status, headers, body)
+--   responses = responses + 1
+--end

 function done(summary, latency, requests)
    for index, thread in ipairs(threads) do
    
$ ./wrk -c 4 -t 2 -d 60 --timeout 300 -s scripts/setup.lua https://test.io/1GB.data
thread 1 created
thread 2 created
Running 1m test @ https://test.io/1GB.data
  2 threads and 4 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.14s   824.71ms   6.39s    81.08%
    Req/Sec     1.69      3.42    10.00     86.89%
  74 requests in 1.00m, 76.44GB read
Requests/sec:      1.23
Transfer/sec:      1.27GB
thread 1 made 43 requests and got 0 responses
thread 2 made 36 requests and got 0 responses

Without script

$ ./wrk -c 4 -t 2 -d 60 --timeout 300  https://test.io/1GB.data
Running 1m test @ https://test.io/1GB.data
  2 threads and 4 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.39s     1.26s    6.52s    79.10%
    Req/Sec     0.80      2.22    10.00     93.94%
  67 requests in 1.00m, 68.88GB read
  Non-2xx or 3xx responses: 1
Requests/sec:      1.12
Transfer/sec:      1.15GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant