Skip to content

Instantly share code, notes, and snippets.

@painfull30
Forked from bigomega/load-test.sh
Last active May 1, 2020 07:44
Show Gist options
  • Save painfull30/7533e759b22c996752c5d5477be73089 to your computer and use it in GitHub Desktop.
Save painfull30/7533e759b22c996752c5d5477be73089 to your computer and use it in GitHub Desktop.
A simple bash script to do load (performance) testing of a web service
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
nice curl -s -insecure -v "$1" 2>&1 | tr '\r\n' '\\n' | awk -v date="$(date +'%r')" '{print $0"\n-----", date}' >> /tmp/perf-test.log
}
/etc/init.d/uhttpd restart
killall -9 curl 2>/dev/null
while true
do
echo $(($(date +%s) - START)) $(jobs | wc -l | xargs) | awk '{print int($1/60)":"int($1%60)":"$2}'
sleep 1
for i in `seq 1 $max`
do
get $2 &
done
done
@painfull30
Copy link
Author

openwrt uhttpd stress-tests

bash /load-test.sh 111 "http://127.0.0.1:80/test111"
bash /load-test.sh 111 "http://127.0.0.1:10080/test111"

bash /load-test.sh 111 "https://127.0.0.1:443/test111"
bash /load-test.sh 111 "https://127.0.0.1:10443/test111"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment