Skip to content

Instantly share code, notes, and snippets.

@Maqiushi
Created May 24, 2017 08:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Maqiushi/7a5c616b3ea14d26c1956f0caac7808a to your computer and use it in GitHub Desktop.
Save Maqiushi/7a5c616b3ea14d26c1956f0caac7808a to your computer and use it in GitHub Desktop.
simple wrk benchmark for posting binary file
--Read the binary file, lua takes binary files with no difference to strings(all UNIX;https://www.lua.org/pil/21.2.2.html). But, use 'b' tag
local inp = assert(io.open("xxxx.xml.gz", "rb"))
local data = inp:read("*all")
--HTTP custom settings
--Remember to set the schema, host and port here otherwise it will use default.
wrk.scheme = "http"
wrk.host = "localhost"
wrk.port = 3000
wrk.method = "POST"
wrk.path = "/"
wrk.headers["Content-Encoding"] = "gzip"
wrk.headers["Content-Type"] = "text/xml"
wrk.body = data
#4 threads, 10 connections, 10 secs duration, 30s timeout limit.
wrk -t4 -c10 -d10s -T30s --script=postFile.lua --latency http://localhost:3000/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment