Skip to content

Instantly share code, notes, and snippets.

@sokomo
Created January 7, 2016 09:00
Show Gist options
  • Save sokomo/2c381ccf179f3d0c93e5 to your computer and use it in GitHub Desktop.
Save sokomo/2c381ccf179f3d0c93e5 to your computer and use it in GitHub Desktop.

Wrk tools Guide

The script using tool from Wrk

Preparation

  1. Modify variable file (vars file):
# Number of connection
CONNUM=10

# Test duration, Time arguments may include a time unit (2s, 2m, 2h)
DURATION=30

# Number of threads
THREADS=1

# URL path to benchmark
URL="http://202.43.110.115/users"

# Lua script path (for specific options)
SCRIPT="lua_script/post_test.lua"


# Wrk file path
WRK="/home/dev2/wrk/wrk"

If not using any lua script, please leave the SCRIPT variable blank:

SCRIPT=""
  1. (Addition) Modify option in lua script
-- Method can be POST or GET
wrk.method = "POST"

-- Set POST body data, must be string
wrk.body   = "foo=bar&baz=quux"

-- Set header, can be used with JSON send
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
  1. Set execute mode to the script To be able to run the script, set execute mode to the script
chmod +x test_script

Run the script

  • To run the script, just type:
<script path>/test_script > <output file name>

or

/usr/bin/bash <script path>/test_script
  • To get output report to file, just type:
<script path>/test_script

or

/usr/bin/bash <script path>/test_script > <output file name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment