Wrk: Difference between revisions
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
==Playground== | ==Playground== | ||
{| | |||
| valign="top"| | |||
<source lang="bash"> | <source lang="bash"> | ||
cat <<'EOF' > ~/Documents/wrk-playground/test-urlencoded-data.lua | cat <<'EOF' > ~/Documents/wrk-playground/test-urlencoded-data.lua | ||
Line 25: | Line 27: | ||
--latency "http://server_ip:1234/demo" | --latency "http://server_ip:1234/demo" | ||
</source> | </source> | ||
| valign="top" | | |||
<source lang="bash"> | |||
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" | |||
</source> | |||
|- | |||
| colspan="2" | | |||
---- | |||
|- | |||
| valign="top" | | |||
| valign="top" | | |||
|} | |||
==References== | ==References== |
Revision as of 06:17, 15 January 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
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
| ||