public
Created

curl timer fetch stackexchange CDNs

  • Download Gist
cdn_tester.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/bin/bash
 
REPEAT=20
TIMER=0
 
function fetchTimer {
URL=$1
 
CURRENT_TIME=`curl --compressed -w '%{time_total}' -o /dev/null -s $URL`;
TIMER=`echo "$CURRENT_TIME + $TIMER" | bc`
}
 
for url in "http://sstatic.net/js/full.js" "http://sstatic.stackexchange.netdna-cdn.com/js/full.js" "http://d1d5ue6vu5b30i.cloudfront.net/js/full.js" "http://wac.43df.edgecastcdn.net/8043DF/sstatic/js/full.js"; do
TIMER=0
for (( i=1; i<=$REPEAT; i++ )); do
fetchTimer $url
done
 
echo $url
echo "scale=2; (1000 * ${TIMER}) / ${REPEAT}" | bc
done

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.