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

wrk2 vs wrk Lua difference #112

Open
olotenko opened this issue Jun 23, 2021 · 0 comments
Open

wrk2 vs wrk Lua difference #112

olotenko opened this issue Jun 23, 2021 · 0 comments

Comments

@olotenko
Copy link

threads = {}
resps = {}

setup = function(thread)
   table.insert(threads, thread)
end

response = function(status, headers, body)
   if status == 200 then
      resps['a'] = 1
   end
end

done = function(summary, latency, requests)
   for _, thread in ipairs(threads) do
      for k, v in pairs(thread:get('resps')) do
         print(k, v)
      end
   end
end

Then:

$ wrk -d 3 -s report.lua ...
a       1
a       1

(Observe it printed keys and values)

$ wrk2 -d 3 -s report.lua ...
1       a
1       a

(Observe pairs swapped around k and v for the table returned by thread.get)

This is based on the latest wrk and wrk2.

FROM buildpack-deps:bionic

RUN apt-get update && apt-get install -yqq libluajit-5.1-dev libssl-dev luajit

WORKDIR /wrk
COPY wrk-4.1.0.tar.gz wrk-4.1.0.tar.gz
RUN tar xfz wrk-4.1.0.tar.gz --strip-components=1
ENV LDFLAGS="-O3 -march=native -flto"
ENV CFLAGS="-I /usr/include/luajit-2.1 $LDFLAGS"
RUN make WITH_LUAJIT=/usr WITH_OPENSSL=/usr -j "$(nproc)"
RUN cp wrk /usr/local/bin

WORKDIR /
COPY wrk2.zip wrk2.zip # downloaded source as zip from github
RUN unzip wrk2.zip
WORKDIR /wrk2-master

ENV LDFLAGS="-O3 -march=native -flto"
ENV CFLAGS="-I /usr/include/luajit-2.1 $LDFLAGS"
RUN make WITH_LUAJIT=/usr WITH_OPENSSL=/usr -j "$(nproc)"
RUN cp wrk /usr/local/bin/wrk2

WORKDIR /wrk
olotenko added a commit to olotenko/wrk2 that referenced this issue Jun 23, 2021
rrva added a commit to rrva/wrk2 that referenced this issue Feb 9, 2022
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