use ioping for disk reads; fix ipv4/v6 detection; updated readme

This commit is contained in:
Mason Rowe 2019-10-08 14:36:02 -04:00
parent a4a452d969
commit 4946886ebb
3 changed files with 98 additions and 94 deletions

View File

@ -10,7 +10,7 @@ This script isn't an attempt to be a golden standard. It's just yet another benc
`curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/yabs.sh | bash`
This script has been tested on CentOS 7, Debian 9, Debian 10, Fedora 30, Ubuntu 16.04, and Ubuntu 18.04. It is designed to not require any external dependencies to be installed nor elevated privileges.
This script has been tested on CentOS 7, CentOS 8, Debian 9, Debian 10, Fedora 30, Ubuntu 16.04, and Ubuntu 18.04. It is designed to not require any external dependencies to be installed nor elevated privileges.
### Skipping Tests
@ -21,15 +21,15 @@ curl https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/ya
./yabs.sh -{dig}
```
* `-d` this option disables the dd (disk performance) test
* `-d` this option disables the dd/ioping (disk performance) test
* `-i` this option disables the iperf (network performance) test
* `-g` this option disables the Geekbench (system performance) test
Options can be grouped together to skip multiple tests, i.e. `./yabs -dg` to skip the dd and Geekbench tests (effectively only performing the iperf test).
Options can be grouped together to skip multiple tests, i.e. `./yabs -dg` to skip the disk and system performance tests (effectively only testing network performance).
## 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.
* **dd** & **ioping** - the dd utility is utilized to test sequential write disk performance and the ioping utility is used to test sequential read disk performance.
* **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.
* **Geekbench 4** - Geekbench is a benchmarking program that measures system performance, which is widely used in the tech community. The web URL is displayed to be able to see complete test and individual benchmark results and allow comparison to other geekbench'd systems. The claim URL to add the Geekbench 4 result to your Geekbench profile is written to a file in the directory that this script is executed from.
@ -38,66 +38,70 @@ Options can be grouped together to skip multiple tests, i.e. `./yabs -dg` to ski
```
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2019-10-06 #
# v2019-10-08 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Oct 6 22:03:26 EDT 2019
Tue Oct 8 12:27:29 EDT 2019
Basic System Information:
---------------------------------
Processor : Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz
CPU cores : 8 @ 1600.091 MHz
CPU cores : 8 @ 1600.270 MHz
AES-NI : ✔ Enabled
VM-x/AMD-V : ❌ Disabled
VM-x/AMD-V : ✔ Enabled
RAM : 31G
Swap : 7.5G
Disk : 213G
dd Disk Speed Tests:
Disk Speed Tests:
---------------------------------
| Test 1 | Test 2 | Test 3 | Avg
| | | |
Write | 361 MB/s | 357 MB/s | 357 MB/s | 358.333 MB/s
Read* | 409 MB/s | 409 MB/s | 410 MB/s | 409.333 MB/s
| Test 1 | Test 2 | Test 3 | Avg
| | | |
Write | 363.00 MB/s | 361.00 MB/s | 354.00 MB/s | 359.33 MB/s
Read | 411.58 MB/s | 399.94 MB/s | 398.18 MB/s | 403.23 MB/s
iperf3 Network Speed Tests (IPv4):
---------------------------------
Provider | Location (Link) | Send Speed | Recv Speed
| | |
Bouygues Telecom | Paris, FR (10G) | 766 Mbits/sec | 195 Mbits/sec
Online.net | Paris, FR (10G) | 771 Mbits/sec | 156 Mbits/sec
Severius | The Netherlands (10G) | 638 Mbits/sec | 45.5 Mbits/sec
Worldstream | The Netherlands (10G) | 748 Mbits/sec | 56.7 Mbits/sec
wilhelm.tel | Hamburg, DE (10G) | 756 Mbits/sec | 69.1 Mbits/sec
Bouygues Telecom | Paris, FR (10G) | 348 Mbits/sec | 223 Mbits/sec
Online.net | Paris, FR (10G) | 770 Mbits/sec | 142 Mbits/sec
Severius | The Netherlands (10G) | 687 Mbits/sec | 106 Mbits/sec
Worldstream | The Netherlands (10G) | 739 Mbits/sec | 86.1 Mbits/sec
wilhelm.tel | Hamburg, DE (10G) | 775 Mbits/sec | 85.0 Mbits/sec
Biznet | Bogor, Indonesia (1G) | busy | busy
Hostkey | Moscow, RU (1G) | 722 Mbits/sec | 489 Mbits/sec
Velocity Online | Tallahassee, FL, US (1G) | 528 Mbits/sec | 374 Mbits/sec
Airstream Communications | Eau Claire, WI, US (10G) | 825 Mbits/sec | 156 Mbits/sec
Hurricane Electric | Fremont, CA, US (1G) | 782 Mbits/sec | busy
Hostkey | Moscow, RU (1G) | 639 Mbits/sec | 438 Mbits/sec
Velocity Online | Tallahassee, FL, US (10G) | 852 Mbits/sec | 312 Mbits/sec
Airstream Communications | Eau Claire, WI, US (10G) | 806 Mbits/sec | 114 Mbits/sec
Hurricane Electric | Fremont, CA, US (10G) | 728 Mbits/sec | busy
iperf3 Network Speed Tests (IPv6):
---------------------------------
Provider | Location (Link) | Send Speed | Recv Speed
| | |
Bouygues Telecom | Paris, FR (10G) | 463 Mbits/sec | 186 Mbits/sec
Online.net | Paris, FR (10G) | 713 Mbits/sec | 75.7 Mbits/sec
Severius | The Netherlands (10G) | 753 Mbits/sec | 73.5 Mbits/sec
Worldstream | The Netherlands (10G) | 740 Mbits/sec | 58.6 Mbits/sec
wilhelm.tel | Hamburg, DE (10G) | 744 Mbits/sec | 75.0 Mbits/sec
Airstream Communications | Eau Claire, WI, US (10G) | 473 Mbits/sec | 149 Mbits/sec
Hurricane Electric | Fremont, CA, US (1G) | busy | busy
Bouygues Telecom | Paris, FR (10G) | 724 Mbits/sec | 241 Mbits/sec
Online.net | Paris, FR (10G) | 608 Mbits/sec | 93.6 Mbits/sec
Severius | The Netherlands (10G) | 291 Mbits/sec | 103 Mbits/sec
Worldstream | The Netherlands (10G) | 699 Mbits/sec | 80.4 Mbits/sec
wilhelm.tel | Hamburg, DE (10G) | 630 Mbits/sec | 77.3 Mbits/sec
Airstream Communications | Eau Claire, WI, US (10G) | 783 Mbits/sec | 190 Mbits/sec
Hurricane Electric | Fremont, CA, US (10G) | busy | busy
Geekbench 4 Benchmark Test:
---------------------------------
Test | Value
|
Single Core | 4012
Multi Core | 13007
Full Test | https://browser.geekbench.com/v4/cpu/14768101
Single Core | 4015
Multi Core | 13157
Full Test | https://browser.geekbench.com/v4/cpu/14775012
```
## Acknoledgements
This script was inspired by several great benchmarking scripts out there, including, but not limited to, [bench.sh](https://bench.sh/), [nench.sh](https://github.com/n-st/nench), [ServerBench](https://github.com/K4Y5/ServerBench), among others. Members of both the [HostBalls](https://hostballs.com) and [LowEndTalk](https://www.lowendtalk.com) hosting-related communities play a pivotal role in testing, evaluating, and shaping this script as it matures.
## License
```
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

BIN
ioping Executable file

Binary file not shown.

124
yabs.sh
View File

@ -2,7 +2,7 @@
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
echo -e '# Yet-Another-Bench-Script #'
echo -e '# v2019-10-07 #'
echo -e '# v2019-10-08 #'
echo -e '# https://github.com/masonr/yet-another-bench-script #'
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
@ -31,94 +31,96 @@ 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"`
YABS_PATH=./$DATE/
YABS_PATH=./$DATE
touch $DATE.test 2> /dev/null
if [ ! -f "$DATE.test" ]; then
echo -e
echo -e "You do not have write permission in this directory. Switch to an owned directory and re-run the script.\nExiting..."
exit 1
fi
rm $DATE.test
mkdir -p $YABS_PATH
SKIP_DD=""
SKIP_DISK=""
SKIP_IPERF=""
SKIP_GEEKBENCH=""
while getopts 'dig' flag; do
case "${flag}" in
d) SKIP_DD="True" ;;
d) SKIP_DISK="True" ;;
i) SKIP_IPERF="True" ;;
g) SKIP_GEEKBENCH="True" ;;
*) exit 1 ;;
esac
done
function dd_test {
function disk_test {
I=0
DD_WRITE_TEST_RES=()
DD_READ_TEST_RES=()
DD_WRITE_TEST_AVG=0
DD_READ_TEST_AVG=0
DISK_WRITE_TEST_RES=()
DISK_READ_TEST_RES=()
DISK_WRITE_TEST_AVG=0
DISK_READ_TEST_AVG=0
OS=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
while [ $I -lt 3 ]
do
DD_WRITE_TEST=$(dd if=/dev/zero of=$YABS_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $8 " " $9 }') || DD_WRITE_TEST=$(echo $DD_WRITE_TEST | awk '{ print $10 " " $11 }')
DD_WRITE_TEST_RES+=( "$DD_WRITE_TEST" )
VAL=$(echo $DD_WRITE_TEST | cut -d " " -f 1)
[[ "$DD_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
DISK_WRITE_TEST=$(dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1)
[[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DISK_WRITE_TEST_RES+=( "$VAL" )
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
DD_READ_TEST=$(dd if=$YABS_PATH/$DATE.test of=/dev/null bs=64k |& grep copied)
[[ "$OS" == *"CentOS"* ]] && DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $8 " " $9 }') || DD_READ_TEST=$(echo $DD_READ_TEST | awk '{ print $10 " " $11 }')
DD_READ_TEST_RES+=( "$DD_READ_TEST" )
VAL=$(echo $DD_READ_TEST | cut -d " " -f 1)
[[ "$DD_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
DISK_READ_TEST=$($DISK_PATH/ioping -R -L -D -B -w 6 . | awk '{ print $4 / 1000 / 1000 }')
DISK_READ_TEST_RES+=( "$DISK_READ_TEST" )
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" -v b="$DISK_READ_TEST" 'BEGIN { print a + b }')
I=$(( $I + 1 ))
done
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" 'BEGIN { print a / 3 }')
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" 'BEGIN { print a / 3 }')
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" 'BEGIN { print a / 3 }')
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" 'BEGIN { print a / 3 }')
}
if [ -z "$SKIP_DD" ]; then
echo -e "Performing dd disk performance test. This may take a couple minutes to complete..."
touch $YABS_PATH/$DATE.test 2> /dev/null
if [ -f "$YABS_PATH/$DATE.test" ]; then
dd_test
if [ $(echo $DD_WRITE_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
DD_WRITE_TEST_AVG=$(awk -v a="$DD_WRITE_TEST_AVG" 'BEGIN { print a / 1000 }')
DD_WRITE_TEST_UNIT="GB/s"
else
DD_WRITE_TEST_UNIT="MB/s"
fi
if [ $(echo $DD_READ_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
DD_READ_TEST_AVG=$(awk -v a="$DD_READ_TEST_AVG" 'BEGIN { print a / 1000 }')
DD_READ_TEST_UNIT="GB/s"
else
DD_READ_TEST_UNIT="MB/s"
fi
echo -en "\e[1A"; echo -e "\e[0K\r"
echo -e "dd Disk Speed Tests:"
echo -e "---------------------------------"
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}"
if [ -z "$SKIP_DISK" ]; then
echo -e "Performing disk performance test. This may take a couple minutes to complete..."
DISK_PATH=$YABS_PATH/disk
mkdir -p $DISK_PATH
curl -s https://raw.githubusercontent.com/masonr/yet-another-bench-script/master/ioping -o $DISK_PATH/ioping
chmod +x $DISK_PATH/ioping
disk_test
if [ $(echo $DISK_WRITE_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" 'BEGIN { print a / 1000 }')
DISK_WRITE_TEST_UNIT="GB/s"
else
echo -en "\e[1A"; echo -e "\e[0K\r"
echo -e "You do not have write permission in this directory\nSwitch to a different directory to test disk speed.\nSkipping dd tests."
DISK_WRITE_TEST_UNIT="MB/s"
fi
if [ $(echo $DISK_READ_TEST_AVG | cut -d "." -f 1) -ge 1000 ]; then
DISK_READ_TEST_AVG=$(awk -v a="$DISK_READ_TEST_AVG" 'BEGIN { print a / 1000 }')
DISK_READ_TEST_UNIT="GB/s"
else
DISK_READ_TEST_UNIT="MB/s"
fi
echo -en "\e[1A"; echo -e "\e[0K\r"
echo -e "Disk Speed Tests:"
echo -e "---------------------------------"
printf "%-6s | %-6s %-4s | %-6s %-4s | %-6s %-4s | %-6s %-4s\n" "" "Test 1" "" "Test 2" "" "Test 3" "" "Avg" ""
printf "%-6s | %-6s %-4s | %-6s %-4s | %-6s %-4s | %-6s %-4s\n"
printf "%-6s | %-6.2f MB/s | %-6.2f MB/s | %-6.2f MB/s | %-6.2f %-4s\n" "Write" "${DISK_WRITE_TEST_RES[0]}" "${DISK_WRITE_TEST_RES[1]}" "${DISK_WRITE_TEST_RES[2]}" "${DISK_WRITE_TEST_AVG}" "${DISK_WRITE_TEST_UNIT}"
printf "%-6s | %-6.2f MB/s | %-6.2f MB/s | %-6.2f MB/s | %-6.2f %-4s\n" "Read" "${DISK_READ_TEST_RES[0]}" "${DISK_READ_TEST_RES[1]}" "${DISK_READ_TEST_RES[2]}" "${DISK_READ_TEST_AVG}" "${DISK_READ_TEST_UNIT}"
fi
function iperf_test {
URL=$1
PORTS=$2
FLAGS=$3
I=0
while [ $I -lt 10 ]
do
PORT=`shuf -i $PORTS -n 1`
IPERF_RUN_SEND="$(LD_LIBRARY_PATH=$IPERF_PATH timeout 15 $IPERF_PATH/iperf3 -c $URL -p $PORT -P 8)"
IPERF_RUN_SEND="$(LD_LIBRARY_PATH=$IPERF_PATH timeout 15 $IPERF_PATH/iperf3 $FLAGS -c $URL -p $PORT -P 8)"
if [[ "$IPERF_RUN_SEND" == *"receiver"* && "$IPERF_RUN_SEND" != *"error"* ]]; then
SPEED=$(echo "${IPERF_RUN_SEND}" | grep SUM | grep receiver | awk '{ print $6 }')
[[ -z $SPEED || "$SPEED" == "0.00" ]] && I=$(( $I + 1 )) || I=10
@ -145,7 +147,8 @@ function iperf_test {
}
function launch_iperf {
MODE=$1
MODE=$1
[[ "$MODE" == *"IPv6"* ]] && IPERF_FLAGS="-6" || IPERF_FLAGS=""
echo -e
echo -e "iperf3 Network Speed Tests ($MODE):"
@ -156,7 +159,7 @@ function launch_iperf {
for (( i = 0; i < IPERF_LOCS_NUM; i++ )); do
if [[ "${IPERF_LOCS[i*5+4]}" == *"$MODE"* ]]; then
echo -e "Performing $MODE iperf3 test to ${IPERF_LOCS[i*5+2]}..."
iperf_test "${IPERF_LOCS[i*5]}" "${IPERF_LOCS[i*5+1]}"
iperf_test "${IPERF_LOCS[i*5]}" "${IPERF_LOCS[i*5+1]}" "$IPERF_FLAGS"
echo -en "\e[1A"
IPERF_SENDRESULT_VAL=$(echo $IPERF_SENDRESULT | awk '{ print $6 }')
IPERF_SENDRESULT_UNIT=$(echo $IPERF_SENDRESULT | awk '{ print $7 }')
@ -176,11 +179,8 @@ if [ -z "$SKIP_IPERF" ]; then
curl -s -o $IPERF_PATH/iperf3 https://iperf.fr/download/ubuntu/iperf3_3.1.3 > /dev/null
chmod +x $IPERF_PATH/iperf3
PING_FLAG=$(man ping | grep -- " -4")
[ -z "$PING_FLAG" ] && IPV4_CHECK=$(ping -c 1 -W 4 google.com 2> /dev/null) || IPV4_CHECK=$(ping -c 1 -W 4 -4 google.com 2> /dev/null)
[[ "$IPV4_CHECK" == *"1 received"* ]] && IPV4_CHECK="True" || IPV4_CHECK=""
[ -z "$PING_FLAG" ] && IPV6_CHECK=$(ping6 -c 1 -W 4 ipv6.google.com 2> /dev/null) || IPV6_CHECK=$(ping -c 1 -W 4 -6 ipv6.google.com 2> /dev/null)
[[ "$IPV6_CHECK" == *"1 received"* ]] && IPV6_CHECK="True" || IPV6_CHECK=""
IPV4_CHECK=$(curl -s -4 -m 4 icanhazip.com 2> /dev/null)
IPV6_CHECK=$(curl -s -6 -m 4 icanhazip.com 2> /dev/null)
IPERF_LOCS=( \
"bouygues.iperf.fr" "5200-5209" "Bouygues Telecom" "Paris, FR (10G)" "IPv4|IPv6" \
@ -199,8 +199,8 @@ if [ -z "$SKIP_IPERF" ]; then
IPERF_LOCS_NUM=${#IPERF_LOCS[@]}
IPERF_LOCS_NUM=$((IPERF_LOCS_NUM / 5))
[ -z "$IPv4_CHECK" ] && launch_iperf "IPv4"
[ -z "$IPv6_CHECK" ] && launch_iperf "IPv6"
[ ! -z "$IPV4_CHECK" ] && launch_iperf "IPv4" "-4"
[ ! -z "$IPV6_CHECK" ] && launch_iperf "IPv6" "-6"
fi
if [ -z "$SKIP_GEEKBENCH" ]; then