Wrk: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <syntaxhighlight lang="bash"> | ||
# macos | # macos | ||
brew install wrk | brew install wrk | ||
Line 11: | Line 11: | ||
sudo make clean | sudo make clean | ||
wrk --help | wrk --help | ||
</ | </syntaxhighlight> | ||
==Wrk Options== | ==Wrk Options== | ||
< | <syntaxhighlight lang="bash"> | ||
wrk -t 6 -c 200 -d 30s --latency https://google.com | wrk -t 6 -c 200 -d 30s --latency https://google.com | ||
Line 33: | Line 33: | ||
Time arguments may include a time unit (2s, 2m, 2h) | Time arguments may include a time unit (2s, 2m, 2h) | ||
EOC | EOC | ||
</ | </syntaxhighlight> | ||
For connections and threads, the author suggest '''using thread number less than the core in CPU.''' The connections are shared in different threads, i.e., each threads get '''N = connections/threads''' connections. | For connections and threads, the author suggest '''using thread number less than the core in CPU.''' The connections are shared in different threads, i.e., each threads get '''N = connections/threads''' connections. | ||
Line 40: | Line 40: | ||
{| | {| | ||
| valign="top"| | | valign="top"| | ||
< | <syntaxhighlight lang="bash"> | ||
cat <<'EOF' > ~/Documents/wrk-playground/test-urlencoded-data.lua | cat <<'EOF' > ~/Documents/wrk-playground/test-urlencoded-data.lua | ||
wrk.method = "POST" | wrk.method = "POST" | ||
Line 50: | Line 50: | ||
-s ~/Documents/wrk-playground/test-urlencoded-data.lua\ | -s ~/Documents/wrk-playground/test-urlencoded-data.lua\ | ||
--latency "http://server_ip:1234/demo" | --latency "http://server_ip:1234/demo" | ||
</ | </syntaxhighlight> | ||
| valign="top" | | | valign="top" | | ||
< | <syntaxhighlight lang="bash"> | ||
cat <<'EOF' > ~/Documents/wrk-playground/test-application-json.lua | cat <<'EOF' > ~/Documents/wrk-playground/test-application-json.lua | ||
wrk.method = "POST" | wrk.method = "POST" | ||
Line 63: | Line 63: | ||
-s ~/Documents/wrk-playground/test-application-json.lua\ | -s ~/Documents/wrk-playground/test-application-json.lua\ | ||
--latency "http://server_ip:1234/demo" | --latency "http://server_ip:1234/demo" | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
Line 80: | Line 80: | ||
* [https://stackoverflow.com/questions/68465947/ wrk » LuaJIT » Generate Multiple POST Requests] | * [https://stackoverflow.com/questions/68465947/ wrk » LuaJIT » Generate Multiple POST Requests] | ||
* [https://stackoverflow.com/questions/73938551/ wrk » LuaJIT » Test a Sequence of Requests] | * [https://stackoverflow.com/questions/73938551/ wrk » LuaJIT » Test a Sequence of Requests] | ||
* [http://czerasz.com/2015/07/19/wrk-http-benchmarking-tool-example/ wrk » LuaJIT » Advanced Example] | |||
* [https://github.com/wg/wrk/tree/master/scripts wrk » LuaJIT » Example Scripts] | * [https://github.com/wg/wrk/tree/master/scripts wrk » LuaJIT » Example Scripts] | ||
* [https://github.com/wg/wrk/issues/189 | * [https://github.com/wg/wrk/issues/189 wrk » LuaJIT » Simple Scenario] | ||
* [https://github.com/wg/wrk wrk » HTTP benchmarking tool] | * [https://github.com/wg/wrk wrk » HTTP benchmarking tool] | ||
* [https://medium.com/@felipedutratine/intelligent-benchmark-with-wrk-163986c1587f wrk » Intelligent benchmark] | * [https://medium.com/@felipedutratine/intelligent-benchmark-with-wrk-163986c1587f wrk » Intelligent benchmark] | ||
Line 89: | Line 90: | ||
| valign="top" | | | valign="top" | | ||
* [https://www.networknt.com/tool/wrk-perf/ wrk » LuaJIT » Performance Test] | |||
| valign="top" | | | valign="top" | | ||
Line 99: | Line 101: | ||
* [[Homebrew]] | * [[Homebrew]] | ||
* [[ZA Proxy]] | * [[ZA Proxy]] | ||
* [[Cypress]] | |||
* [https://gatling.io/ Gatling] | * [https://gatling.io/ Gatling] | ||
* [[HTTPie]] | * [[HTTPie]] | ||
* [[JQ Tool]] | * [[JQ Tool]] | ||
* [[Locust]] | |||
* [[JMeter]] | * [[JMeter]] | ||
* [[LuaJIT]] | * [[LuaJIT]] | ||
* [[Lua]] | |||
| valign="top" | | | valign="top" | | ||
* [https://k6.io/open-source/ K6 Open Source] | |||
* [[CURL]] | |||
| valign="top" | | | valign="top" | | ||
|} | |} |
Latest revision as of 19:37, 22 April 2024
# macos
brew install wrk
wrk --help
# debian / ubuntu
sudo apt install build-essential libssl-dev git -y
git clone https://github.com/wg/wrk.git && cd wrk
sudo make && sudo cp wrk /usr/local/bin
ls -lah /usr/local/bin|grep wrk
sudo make clean
wrk --help
Wrk Options
wrk -t 6 -c 200 -d 30s --latency https://google.com
: <<'EOC'
Usage: wrk <options> <url>
Options:
-c, --connections <N> Connections to keep open
-d, --duration <T> Duration of test
-t, --threads <N> Number of threads to use
-s, --script <S> Load Lua script file
-H, --header <H> Add header to request
--latency Print latency statistics
--timeout <T> Socket/request timeout
-v, --version Print version details
Numeric arguments may include a SI unit (1k, 1M, 1G)
Time arguments may include a time unit (2s, 2m, 2h)
EOC
For connections and threads, the author suggest using thread number less than the core in CPU. The connections are shared in different threads, i.e., each threads get N = connections/threads connections.
Playground
cat <<'EOF' > ~/Documents/wrk-playground/test-urlencoded-data.lua
wrk.method = "POST"
wrk.body = "width=2&height=2"
wrk.headers['Content-Type'] = "application/x-www-form-urlencoded"
EOF
wrk -t 4 -c 100 -d 180s\
-s ~/Documents/wrk-playground/test-urlencoded-data.lua\
--latency "http://server_ip:1234/demo"
|
cat <<'EOF' > ~/Documents/wrk-playground/test-application-json.lua
wrk.method = "POST"
wrk.body = '{"width": 2, "height": 2}'
wrk.headers['Content-Type'] = "application/json"
EOF
wrk -t 4 -c 100 -d 180s\
-s ~/Documents/wrk-playground/test-application-json.lua\
--latency "http://server_ip:1234/demo"
|
| |
References
| ||