Created
April 6, 2016 14:05
-
-
Save SindreSvendby/aa07f4458df348c64cdd5f52b5e44778 to your computer and use it in GitHub Desktop.
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
# Send in urls as arguments, this | |
# script will loop over the arguments and do 100 request to each url | |
# it will report the Average time to first byte for each site. | |
LOOP=100; | |
for SITE in "$@" | |
do | |
echo "Requesting $SITE $LOOP times ..."; | |
SUM=0; | |
for i in $(seq 1 $LOOP) | |
do | |
TTFB=`curl -o /dev/null -w "%{time_starttransfer}" $SITE 2>/dev/null | sed 's/,/./'`; | |
echo -e "$i: $TTFB"; | |
SUM=`bc <<< "$SUM + $TTFB"`; | |
done; | |
echo "Average TTFB for $SITE after $LOOP number of times is `bc <<< "scale=3;$SUM/$LOOP"`))"; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment