Skip to content

Instantly share code, notes, and snippets.

@hazmihaz
Forked from bigomega/load-test.sh
Created June 23, 2020 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazmihaz/f271927148de9ae5e674d259fbfaeb3a to your computer and use it in GitHub Desktop.
Save hazmihaz/f271927148de9ae5e674d259fbfaeb3a 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 () {
curl -s -v "$1" 2>&1 | tr '\r\n' '\\n' | awk -v date="$(date +'%r')" '{print $0"\n-----", date}' >> /tmp/perf-test.log
}
while true
do
echo $(($(date +%s) - START)) | awk '{print int($1/60)":"int($1%60)}'
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