From a50d1912dc44fbeb2910af01926cc43c0ba91a39 Mon Sep 17 00:00:00 2001 From: Mason Rowe Date: Fri, 4 Oct 2019 21:14:41 -0400 Subject: [PATCH] fixed some bugs with dd and iperf tests; updated output --- README.md | 45 +++++++++++++++++++++++++------------------ yabs.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 0492387..f6248ab 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This script isn't an attempt to be a golden standard. It's just yet another benc ## Tests Conducted +* **dd** - the dd utility is utilized to test disk performance. Both write and read speeds are evaluated by writing to and reading from a test file. Disclaimer: read speeds may be heavily influenced by cache depending on configuration of the host. * **iperf3** - the industry standard for testing download and upload speeds to various locations. This script utilizes iperf3 with 8 parallel threads and tests both download and upload speeds. If an iperf server is busy after 10 tries, the speed test for that location/direction is skipped. ## Example Output @@ -19,36 +20,44 @@ This script isn't an attempt to be a golden standard. It's just yet another benc ``` # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # Yet-Another-Bench-Script # -# v2019-10-03 # +# v2019-10-04 # # https://github.com/masonr/yet-another-bench-script # # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # -Thu 03 Oct 2019 10:25:48 PM EDT +Fri Oct 4 21:06:05 EDT 2019 Basic System Information: --------------------------------- -Processor : Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz -CPU cores : 4 @ 3499.996 MHz +Processor : Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz +CPU cores : 8 @ 2096.045 MHz AES-NI : ✔ Enabled VM-x/AMD-V : ❌ Disabled -RAM : 3.9Gi -Swap : 511Mi -Disk : 66G +RAM : 31G +Swap : 7.5G +Disk : 213G -iperf3 Speed Tests: +dd Disk Speed Tests: +--------------------------------- + | Test 1 | Test 2 | Test 3 | Avg + | | | | +Write | 361 MB/s | 363 MB/s | 362 MB/s | 362 MB/s +Read | 407 MB/s | 410 MB/s | 412 MB/s | 409 MB/s + +iperf3 Network Speed Tests: --------------------------------- Provider | Location (Link) | Send Speed | Recv Speed | | | -Bouygues Telecom | Paris, FR (10G) | 65.3 Mbits/sec | 179 Mbits/sec -Online.net | Paris, FR (10G) | 892 Mbits/sec | 553 Mbits/sec -Severius | The Netherlands (10G) | 80.0 Mbits/sec | 133 Mbits/sec -Worldstream | The Netherlands (10G) | 77.9 Mbits/sec | 122 Mbits/sec -wilhelm.tel | Hamburg, DE (10G) | 79.7 Mbits/sec | 126 Mbits/sec -Biznet | Bogor, Indonesia (1G) | 0.00 bits/sec | 0.00 bits/sec -Hostkey | Moscow, RU (1G) | 864 Mbits/sec | 882 Mbits/sec -Velocity Online | Tallahassee, FL, US (?G) | 90.4 Mbits/sec | 211 Mbits/sec -Airstream Communications | Eau Claire, WI, US (10G) | 57.8 Mbits/sec | 127 Mbits/sec -Hurricane Electric | Fremont, CA, US (1G) | 4.89 Mbits/sec | 102 Mbits/sec +Bouygues Telecom | Paris, FR (10G) | 759 Mbits/sec | 282 Mbits/sec +Online.net | Paris, FR (10G) | 744 Mbits/sec | 166 Mbits/sec +Severius | The Netherlands (10G) | 782 Mbits/sec | 111 Mbits/sec +Worldstream | The Netherlands (10G) | busy | 75.7 Mbits/sec +wilhelm.tel | Hamburg, DE (10G) | 807 Mbits/sec | 56.7 Mbits/sec +Biznet | Bogor, Indonesia (1G) | busy | busy +Hostkey | Moscow, RU (1G) | 191 Mbits/sec | 474 Mbits/sec +Velocity Online | Tallahassee, FL, US (?G) | 860 Mbits/sec | 452 Mbits/sec +Airstream Communications | Eau Claire, WI, US (10G) | 312 Mbits/sec | 234 Mbits/sec +Hurricane Electric | Fremont, CA, US (1G) | 794 Mbits/sec | busy + ``` ## License diff --git a/yabs.sh b/yabs.sh index 84a6d47..e3a5e78 100755 --- a/yabs.sh +++ b/yabs.sh @@ -2,7 +2,7 @@ echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e '# Yet-Another-Bench-Script #' -echo -e '# v2019-10-03 #' +echo -e '# v2019-10-04 #' echo -e '# https://github.com/masonr/yet-another-bench-script #' echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' @@ -31,7 +31,54 @@ TOTAL_DISK=$(df -t simfs -t ext2 -t ext3 -t ext4 -t btrfs -t xfs -t vfat -t ntfs echo -e "Disk : $TOTAL_DISK" DATE=`date -Iseconds | sed -e "s/:/_/g"` -IPERF_PATH=/tmp/$DATE/iperf +YABS_PATH=/tmp/$DATE/ +mkdir -p $YABS_PATH + +echo -e +echo -e "dd Disk Speed Tests:" +echo -e "---------------------------------" + +function dd_test { + I=0 + DD_WRITE_TEST_RES=() + DD_READ_TEST_RES=() + DD_WRITE_TEST_AVG=0 + DD_READ_TEST_AVG=0 + while [ $I -lt 3 ] + do + DD_WRITE_TEST=$(dd if=/dev/zero of=$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $10 " " $11 }') + DD_WRITE_TEST_RES+=( "$DD_WRITE_TEST" ) + VAL=$(echo $DD_WRITE_TEST | cut -d " " -f 1 | cut -d "." -f 1) + DD_WRITE_TEST_AVG=$(( DD_WRITE_TEST_AVG + VAL )) + + DD_READ_TEST=$(dd if=$DATE.test of=/dev/null bs=64k |& grep copied | awk '{ print $10 " " $11 }') + DD_READ_TEST_RES+=( "$DD_READ_TEST" ) + VAL=$(echo $DD_READ_TEST | cut -d " " -f 1 | cut -d "." -f 1) + DD_READ_TEST_AVG=$(( DD_READ_TEST_AVG + VAL )) + + I=$(( $I + 1 )) + done + DD_WRITE_TEST_AVG=$((DD_WRITE_TEST_AVG/3)) + DD_WRITE_TEST_UNIT=$(echo $DD_WRITE_TEST | awk '{ print $2 }') + DD_READ_TEST_AVG=$((DD_READ_TEST_AVG/3)) + DD_READ_TEST_UNIT=$(echo $DD_READ_TEST | awk '{ print $2 }') +} + +touch $DATE.test 2> /dev/null +if [ -f "$DATE.test" ]; then + dd_test + rm $DATE.test + printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" " " "Test 1" "Test 2" "Test 3" "Avg" + printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" + printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Write" "${DD_WRITE_TEST_RES[0]}" "${DD_WRITE_TEST_RES[1]}" "${DD_WRITE_TEST_RES[2]}" "${DD_WRITE_TEST_AVG} ${DD_WRITE_TEST_UNIT}" + printf "%-6s | %-10s | %-10s | %-10s | %-10s\n" "Read" "${DD_READ_TEST_RES[0]}" "${DD_READ_TEST_RES[1]}" "${DD_READ_TEST_RES[2]}" "${DD_READ_TEST_AVG} ${DD_READ_TEST_UNIT}" + +else + echo -e "You do not have write permission in this directory\nSwitch to a different directory to test disk speed.\nSkipping dd tests." +fi + + +IPERF_PATH=$YABS_PATH/iperf mkdir -p $IPERF_PATH curl -s -o $IPERF_PATH/libiperf.so.0 https://iperf.fr/download/ubuntu/libiperf.so.0_3.1.3 > /dev/null curl -s -o $IPERF_PATH/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 > /dev/null @@ -50,7 +97,7 @@ function iperf_test { SPEED=$(echo "${IPERF_RUN_SEND}" | grep SUM | grep receiver | awk '{ print $6 }') [[ -z $SPEED || "$SPEED" == "0.00" ]] && I=$(( $I + 1 )) || I=10 else - I=$(( $I + 1 )) + [[ "$IPERF_RUN_SEND" == *"unable to connect"* ]] && I=10 || I=$(( $I + 1 )) sleep 2 fi done @@ -64,7 +111,7 @@ function iperf_test { SPEED=$(echo "${IPERF_RUN_RECV}" | grep SUM | grep receiver | awk '{ print $6 }') [[ -z $SPEED || "$SPEED" == "0.00" ]] && J=$(( $J + 1 )) || J=10 else - J=$(( $J + 1 )) + [[ "$IPERF_RUN_RECV" == *"unable to connect"* ]] && J=10 || J=$(( $J + 1 )) sleep 2 fi done @@ -89,7 +136,7 @@ IPERF_LOCS_NUM=${#IPERF_LOCS[@]} IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 4)) echo -e -echo -e "iperf3 Speed Tests:" +echo -e "iperf3 Network Speed Tests:" echo -e "---------------------------------" printf "%-25s | %-25s | %-15s | %-15s\n" "Provider" "Location (Link)" "Send Speed" "Recv Speed" printf "%-25s | %-25s | %-15s | %-15s\n"