Open rewagner87 opened 5 years ago
This works as expected, just remove the assert
:
wrk.method = "POST"
local f = io.open("request.pb", "rb")
wrk.body = f:read("*all")
This works as expected, just remove the
assert
:wrk.method = "POST" local f = io.open("request.pb", "rb") wrk.body = f:read("*all")
Wouldn't this read the disk per request and affect performance?
@tonytonyjan yeah it does look like it's adding some overhead (although I didn't measure the disk I/O):
$ wrk --threads=1 --connections=1 --duration=10s --script="using_io.lua" http://localhost:1234/test
Running 10s test @ http://localhost:3005/nzcp/v1/verify
1 threads and 1 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 344.33ms 83.55ms 622.22ms 86.21%
Req/Sec 2.66 0.72 4.00 86.21%
29 requests in 10.02s, 16.06KB read
Requests/sec: 2.89
Transfer/sec: 1.60KB
$ wrk --threads=1 --connections=1 --duration=10s --script="using_static.lua" http://localhost:1234/test
Running 10s test @ http://localhost:3005/nzcp/v1/verify
1 threads and 1 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 207.19ms 82.15ms 515.03ms 84.62%
Req/Sec 5.18 2.70 10.00 67.35%
49 requests in 10.05s, 26.22KB read
Requests/sec: 4.88
Transfer/sec: 2.61KB
Using hexdump
into a file, regex and then passing raw bytes statically helped for me:
local pdf = "\x65\x72\x20\x5b..." -- eg, pdf
wrk.method = "POST"
wrk.body = pdf
wrk.headers["Content-Type"] = "application/pdf"
This doesn't works for with xml. Getting all 404 in response.
wrk.method = "POST"
local f = io.open("post_con_m2.xml", "r")
wrk.body = f:read("*all")
wrk.headers["Content-Type"] = "application/xml"
wrk.headers["Accept"] = "application/xml"
wrk -t12 -c400 -d30s -s post.lua https://demo.example.com/HubWrapper/ConciseSearch:443
Any idea why ?
Hello,
Has anyone been able to send the contents of a binary file as the request body with wrk?
I have been able to send the contents of a json file by doing this:
But when I try to do something similar with a binary file like so:
It doesn't seem to work. I'm able to use this same pb file with a curl command, but can't get it working quite right with wrk.
Any help would be greatly appreciated.
Thanks!