Created
November 24, 2018 17:32
-
-
Save carlosm3011/375a52bf4931144b899a9cd9b64ba06d to your computer and use it in GitHub Desktop.
Simplistic IPv4/IPv6 relative performance test
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
# uncomment to use google's test objects | |
# logfile="v6v4test_google.csv" | |
# w4url="https://random8168-v6exp3.v4.metric.gstatic.com/v6exp3/6.gif" | |
# w6url="https://random2385-v6exp3.ds.metric.gstatic.com/v6exp3/6.gif" | |
# uncomment to use lacnic's objects | |
logfile="v6v4test_lacnic.csv" | |
#w4url="http://w4.labs.lacnic.net/v6v4test/1000kb.bin" | |
w4url="http://200.7.84.10/v6v4test/1000kb.bin" | |
#w6url="http://w6.labs.lacnic.net/v6v4test/1000kb.bin" | |
w6url="http://[2001:13c7:7001:4000::10]/v6v4test/1000kb.bin" | |
function perform_test() { | |
date | |
start=$(date +%s.%N) | |
wget -q -4 --output-document=/dev/null $w4url | |
durv4=$(echo "$(date +%s.%N) - $start" | bc) | |
printf "Execution time v4: %.6f seconds\n" $durv4 | |
sleep $((1 + RANDOM % 10)) | |
start=$(date +%s.%N) | |
wget -q -6 --output-document=/dev/null $w6url | |
durv6=$(echo "$(date +%s.%N) - $start" | bc) | |
printf "Execution time v6: %.6f seconds\n" $durv6 | |
dif=$(echo "($durv6 - $durv4)*1000" | bc) | |
printf "%s | %.6f | %.6f | %.6f \n" "$(date)" $durv6 $durv4 $dif >> $logfile | |
printf "Difference (negative values favor ipv6): %.6f miliseconds\n" $dif | |
printf "\n" | |
} | |
# main loop | |
echo "Entering test loop, end with CTRL-C" | |
while true | |
do | |
perform_test; | |
sleep 30; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple IPv4/IPv6 relative performance test
This scripts downloads the same file over IPv4 and then over IPv6 and compares the time needed for each download.