The script using tool from Wrk
- 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=""
- (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"
- Set execute mode to the script To be able to run the script, set execute mode to the script
chmod +x test_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>