Last active
February 10, 2021 03:18
-
-
Save ygorth/7afc92d89badcf81ef47fe8e681c5e9f to your computer and use it in GitHub Desktop.
googlebot-load-testing-script
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
# 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