Skip to content

Instantly share code, notes, and snippets.

@ygorth
Last active February 10, 2021 03:18
Show Gist options
  • Save ygorth/7afc92d89badcf81ef47fe8e681c5e9f to your computer and use it in GitHub Desktop.
Save ygorth/7afc92d89badcf81ef47fe8e681c5e9f to your computer and use it in GitHub Desktop.
googlebot-load-testing-script
# How to use:
# curl -L https://gist.githubusercontent.com/ygorth/7afc92d89badcf81ef47fe8e681c5e9f/raw/4d542337675dc23cf357c6d15458da054af480df/googlebot-load-testing-script | bash -s 20 "http://server.com/api"
# This keeps hitting your server at the rate of 20 calls/second until you ask it to stop
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
curl -A "googlebot" -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