-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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"