giltene / wrk2

A constant throughput, correct latency recording variant of wrk
Apache License 2.0
4.28k stars 395 forks source link

Backport of wrk 4.0.0 changes to wrk2 #6

Closed rrva closed 9 years ago

rrva commented 9 years ago

Is below of interest for wrk2? If so, I can spend time cherry-picking individual commits from upstream, rather than this large commit if that is preferred.

Backporting non-statistics related changes which occurred in wrk since wrk2 forked. Primary need was the lua scripting changes making it possible to set each threads ip address from lua.

Upstream scripting changes

HTTP parser

rrva commented 9 years ago

One use-case is following redirects, using a lua script like this:

url = require "url"
orig_address = wrk.lookup(wrk.host, wrk.port or "http")[1]
wrk.headers["Connection"] = "close"

response = function(status, headers, body)
   if status == 302 or status == 301 then
        if redirect_address == nil then
            location = url.parse(headers["Location"])
            redirect_address = wrk.lookup(location.host, location.port or "http")[1]
            print(("Will redirect to: %s"):format(redirect_address))
        end
       wrk.thread.addr = redirect_address
   else
       wrk.thread.addr = orig_address
   end
end
ahothan commented 9 years ago

Are you still working on this? I was about to consider doing the same (backport to wrk 4.x) until I see you did the work already.

rrva commented 9 years ago

I'm not working on it anymore. Feel free to use these changes and continue if you want. I needed the lua scripting changes and the constant rate load generation option.

ahothan commented 9 years ago

allright - thx

rrva commented 9 years ago

Out of curiosity, I saw your go-wrk project. Why would you prefer this one over that? Because of better stats reporting? Higher max load? More exact request rate?

ahothan commented 9 years ago

We're actually using and evaluating giltene/wrk2 right now. If it works sufficiently for us we will stick with it. The go/wrk was just for experimenting and was done before I found wrk2. What is amazing is the number of small forks and each one has its pros/cons (pick your poison). A pity nobody could really unifies every feature back (like backporting wrk2 work to wrk). go-wrk looks nice (smaller code and maybe faster) but not too many go developers right now and does not have the -R feature which I need. For now all we need is a generator that can sustain 10K connections at about 1 rps per connection (on a relatively fast Intel Xeon CPU). I have no idea if that can work but we will see soon. We are lining up a large number of wrk2 generators to load a large number of HTTP servers for an OpenStack scaling app. We can't use wrk unthrottled traffic because that does not represent live http traffic and that overwhelms any form of scale testing very quickly.

giltene commented 9 years ago

I initially didn't want to move the base much, since wrk2 started as a demonstration (of applying correct measurement to a load generator). but it seems to be used by a bunch of people, so I figured updating it makes sense, and the changes here don't seem to interfere with the measurement logic or the throughput throttling. So thanks for the back port work...