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

Help needed invoking multiple addresses #530

Open
sebastienros opened this issue Oct 27, 2023 · 2 comments
Open

Help needed invoking multiple addresses #530

sebastienros opened this issue Oct 27, 2023 · 2 comments

Comments

@sebastienros
Copy link

I'd like to create a LUA script which would invoke different addresses (not paths) each assigned to a thread. It would be similar to the addr.lua script that is provided as a sample, but using specific addresses instead of doing using the lookup method. The goal is to spread the load on different ports of the same server.

I am thinking that these addresses could come from the script arguments, or from a port range taken out of the main addr argument. My issue is that these come as strings, and the thread requires and addr type. I don't understand how to do that with the LUA extensibility. I found a parse_url method in the source but it's not available to the LUA host AFAIK.

@SteveLauC
Copy link

This issue #137 may help you.

I know nothing about lua, but in my case, the following script seems to work:

local addrs = { wrk.lookup("10.0.0.3","11451")[1], wrk.lookup("10.0.0.3","11452")[1] }

function setup(thread)
    random_idx = math.random(#addrs)
    thread.addr = addrs[random_idx]
    print("I will benchmark against: ", thread.addr)
end
$ wrk -s addr.lua -d 30 -t 5 -c 500 http://10.0.0.3:11451/_search
I will benchmark against:       10.0.0.3:11452
I will benchmark against:       10.0.0.3:11452
I will benchmark against:       10.0.0.3:11452
I will benchmark against:       10.0.0.3:11452
I will benchmark against:       10.0.0.3:11451
Running 30s test @ http://10.0.0.3:11451/_search
  5 threads and 500 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.74ms   14.23ms 180.23ms   81.94%
    Req/Sec    15.22k    16.62k   87.27k    90.00%
  2271156 requests in 30.07s, 280.64MB read
Requests/sec:  75520.65
Transfer/sec:      9.33MB

@sebastienros
Copy link
Author

@SteveLauC thanks a lot for this example, will try build from there.

I know nothing about Lua

Right ;)

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

2 participants