nailuoGG
5/3/2017 - 3:38 AM

各大IDC服务器测评 测评脚本 https://bench.sh/

各大IDC服务器测评 测评脚本 https://bench.sh/

----------------------------------------------------------------------
CPU model            : Virtual CPU a7769a6388d5
Number of cores      : 1
CPU frequency        : 2394.450 MHz
Total size of Disk   : 25.0 GB (1.2 GB Used)
Total amount of Mem  : 992 MB (84 MB Used)
Total amount of Swap : 0 MB (0 MB Used)
System uptime        : 0 days, 0 hour 3 min
Load average         : 0.02, 0.04, 0.03
OS                   : CentOS 7.3.1611
Arch                 : x86_64 (64 Bit)
Kernel               : 3.10.0-514.10.2.el7.x86_64
----------------------------------------------------------------------
I/O speed(1st run)   : 360 MB/s
I/O speed(2nd run)   : 348 MB/s
I/O speed(3rd run)   : 348 MB/s
Average I/O speed    : 352.0 MB/s
----------------------------------------------------------------------
Node Name                       IPv4 address            Download Speed
CacheFly                        167.88.158.176          46.6MB/s
Linode, Tokyo, JP               106.187.96.148          28.8MB/s
Linode, Singapore, SG           139.162.23.4            121MB/s
Linode, London, UK              176.58.107.39           11.6MB/s
Linode, Frankfurt, DE           139.162.130.8           13.0MB/s
Linode, Fremont, CA             50.116.14.9             7.54MB/s
Softlayer, Dallas, TX           173.192.68.18           2.83MB/s
Softlayer, Seattle, WA          67.228.112.250          9.27MB/s
Softlayer, Frankfurt, DE        159.122.69.4            3.79MB/s
Softlayer, Singapore, SG        119.81.28.170           109MB/s
Softlayer, HongKong, CN         119.81.130.170          46.8MB/s
----------------------------------------------------------------------
Node Name                       IPv6 address            Download Speed
Linode, Atlanta, GA             2600:3c02::4b           9.51MB/s
Linode, Dallas, TX              2600:3c00::4b           11.1MB/s
Linode, Newark, NJ              2600:3c03::4b           9.59MB/s
Linode, Singapore, SG           2400:8901::4b           92.4MB/s
Linode, Tokyo, JP               2400:8900::4b           26.3MB/s
Softlayer, San Jose, CA         2607:f0d0:2601:2a::4    5.74MB/s
Softlayer, Washington, WA       2607:f0d0:3001:78::2    7.87MB/s
Softlayer, Paris, FR            2a03:8180:1301:8::4     7.72MB/s
Softlayer, Singapore, SG        2401:c900:1101:8::2     104MB/s
Softlayer, Tokyo, JP            2401:c900:1001:16::4    9.52MB/s
----------------------------------------------------------------------
----------------------------------------------------------------------
CPU model            : Intel(R) Xeon(R) CPU D-1540 @ 2.00GHz
Number of cores      : 1
CPU frequency        : 2000.012 MHz
Total size of Disk   : 2.0 GB (1.1 GB Used)
Total amount of Mem  : 72 MB (50 MB Used)
Total amount of Swap : 16 MB (16 MB Used)
System uptime        : 15 days, 3 hour 1 min
Load average         : 0.00, 0.00, 0.00
OS                   : Ubuntu 14.04.5 LTS
Arch                 : i686 (32 Bit)
Kernel               : 2.6.32-042stab108.2
----------------------------------------------------------------------
I/O speed(1st run)   : 60.4 MB/s
I/O speed(2nd run)   : 65.7 MB/s
I/O speed(3rd run)   : 72.3 MB/s
Average I/O speed    : 66.1 MB/s
----------------------------------------------------------------------
Node Name                       IPv4 address            Download Speed
CacheFly                        205.234.175.175         32.8MB/s
Linode, Tokyo, JP               106.187.96.148          9.54MB/s
Linode, Singapore, SG           139.162.23.4            5.93MB/s
Linode, London, UK              176.58.107.39           7.23MB/s
Linode, Frankfurt, DE           139.162.130.8           8.25MB/s
Linode, Fremont, CA             50.116.14.9             18.1MB/s
Softlayer, Dallas, TX           173.192.68.18           30.7MB/s
Softlayer, Seattle, WA          67.228.112.250          25.9MB/s
Softlayer, Frankfurt, DE        159.122.69.4            13.5MB/s
Softlayer, Singapore, SG        119.81.28.170           6.19MB/s
Softlayer, HongKong, CN         119.81.130.170          6.46MB/s
----------------------------------------------------------------------
Node Name                       IPv6 address            Download Speed
Linode, Atlanta, GA             2600:3c02::4b           18.7MB/s
Linode, Dallas, TX              2600:3c00::4b           9.84MB/s
Linode, Newark, NJ              2600:3c03::4b           15.1MB/s
Linode, Singapore, SG           2400:8901::4b           5.87MB/s
Linode, Tokyo, JP               2400:8900::4b           11.5MB/s
Softlayer, San Jose, CA         2607:f0d0:2601:2a::4    36.7MB/s
Softlayer, Washington, WA       2607:f0d0:3001:78::2    13.5MB/s
Softlayer, Paris, FR            2a03:8180:1301:8::4     8.80MB/s
Softlayer, Singapore, SG        2401:c900:1101:8::2     4.88MB/s
Softlayer, Tokyo, JP            2401:c900:1001:16::4    8.72MB/s
----------------------------------------------------------------------
#!/usr/bin/env bash
#
# Description: Auto test download & I/O speed script
#
# Copyright (C) 2015 - 2016 Teddysun <i@teddysun.com>
#
# Thanks: LookBack <admin@dwhd.org>
#
# URL: https://teddysun.com/444.html
#

if  [ ! -e '/usr/bin/wget' ]; then
    echo "Error: wget command not found. You must be install wget command at first."
    exit 1
fi

# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
PLAIN='\033[0m'

get_opsy() {
    [ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return
    [ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return
    [ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return
}

next() {
    printf "%-70s\n" "-" | sed 's/\s/-/g'
}

speed_test() {
    local speedtest=$(wget -4O /dev/null -T300 $1 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}')
    local ipaddress=$(ping -c1 -n `awk -F'/' '{print $3}' <<< $1` | awk -F'[()]' '{print $2;exit}')
    local nodeName=$2
    printf "${YELLOW}%-32s${GREEN}%-24s${RED}%-14s${PLAIN}\n" "${nodeName}" "${ipaddress}" "${speedtest}"
}

speed() {
    speed_test 'http://cachefly.cachefly.net/100mb.test' 'CacheFly'
    speed_test 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'
	speed_test 'http://speedtest.tokyo2.linode.com/100MB-tokyo2.bin' 'Linode, Tokyo2, JP'
    speed_test 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'
    speed_test 'http://speedtest.fremont.linode.com/100MB-fremont.bin' 'Linode, Fremont, CA'
	speed_test 'http://speedtest.newark.linode.com/100MB-newark.bin' 'Linode, Newark, NJ'
    speed_test 'http://speedtest.london.linode.com/100MB-london.bin' 'Linode, London, UK'
    speed_test 'http://speedtest.frankfurt.linode.com/100MB-frankfurt.bin' 'Linode, Frankfurt, DE'
	speed_test 'http://speedtest.tok02.softlayer.com/downloads/test100.zip' 'Softlayer, Tokyo, JP'
	speed_test 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'
	speed_test 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Seoul, KR'
    speed_test 'http://speedtest.hkg02.softlayer.com/downloads/test100.zip' 'Softlayer, HongKong, CN'
    speed_test 'http://speedtest.dal13.softlayer.com/downloads/test100.zip' 'Softlayer, Dallas, TX'
    speed_test 'http://speedtest.sea01.softlayer.com/downloads/test100.zip' 'Softlayer, Seattle, WA'
    speed_test 'http://speedtest.fra02.softlayer.com/downloads/test100.zip' 'Softlayer, Frankfurt, DE'
	speed_test 'http://speedtest.par01.softlayer.com/downloads/test100.zip' 'Softlayer, Paris, FR'
	speed_test 'http://mirror.hk.leaseweb.net/speedtest/100mb.bin' 'Leaseweb, HongKong, CN'
	speed_test 'http://mirror.sg.leaseweb.net/speedtest/100mb.bin' 'Leaseweb, Singapore, SG'
	speed_test 'http://chi.testfiles.ubiquityservers.com/100mb.txt' 'Leaseweb, Chicago, US'
	speed_test 'http://phx.testfiles.ubiquityservers.com/100mb.txt' 'Leaseweb, Phoenix, US'
	speed_test 'http://mirror.wdc1.us.leaseweb.net/speedtest/100mb.bin' 'Leaseweb, Washington D.C., US'
	speed_test 'http://chi.testfiles.ubiquityservers.com/100mb.txt' 'Leaseweb, Chicago, US'
	speed_test 'http://mirror.sfo12.us.leaseweb.net/speedtest/100mb.bin' 'Leaseweb, San Francisco, US'
	speed_test 'http://mirror.nl.leaseweb.net/speedtest/100mb.bin' 'Leaseweb, Netherlands, NL'
	speed_test 'http://proof.ovh.ca/files/100Mio.dat' 'OVH, Montreal, CA'
	speed_test 'http://183.60.137.161/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaTelecom, Dongguan, CN'
	speed_test 'http://14.29.72.152/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaTelecom, Foshan, CN'
	speed_test 'http://222.73.131.40/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaTelecom, Shanghai, CN'
	speed_test 'http://163.177.153.71/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaUnicom, Foshan, CN'
	speed_test 'http://112.90.51.172/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaUnicom, Zhongshan, CN'
	speed_test 'http://111.202.98.38/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaUnicom, Beijing, CN'
	speed_test 'http://223.82.245.41/dl.softmgr.qq.com/original/game/DuiZhanSetup1_8_4_2042_win10.exe' 'ChinaMobile, Jiangxi, CN'
	speed_test 'http://61.233.79.5/setup.exe' 'ChinaTieTong, Henan, CN'
	speed_test 'http://101.4.60.106/setup.exe' 'CERNET, Beijing, CN'
	speed_test 'http://mirrors.opencas.org/apache/ode/apache-ode-war-1.3.6.zip' 'CSTNET, Beijing, CN'
	speed_test 'http://tpdb.speed2.hinet.net/test_100m.zip' 'Hinet, Taiwan, TW'
}

speed_v6() {
    speed_test_v6 'http://speedtest.atlanta.linode.com/100MB-atlanta.bin' 'Linode, Atlanta, GA'
    speed_test_v6 'http://speedtest.dallas.linode.com/100MB-dallas.bin' 'Linode, Dallas, TX'
    speed_test_v6 'http://speedtest.newark.linode.com/100MB-newark.bin' 'Linode, Newark, NJ'
    speed_test_v6 'http://speedtest.singapore.linode.com/100MB-singapore.bin' 'Linode, Singapore, SG'
    speed_test_v6 'http://speedtest.tokyo.linode.com/100MB-tokyo.bin' 'Linode, Tokyo, JP'
    speed_test_v6 'http://speedtest.sjc03.softlayer.com/downloads/test100.zip' 'Softlayer, San Jose, CA'
    speed_test_v6 'http://speedtest.wdc01.softlayer.com/downloads/test100.zip' 'Softlayer, Washington, WA'
    speed_test_v6 'http://speedtest.par01.softlayer.com/downloads/test100.zip' 'Softlayer, Paris, FR'
    speed_test_v6 'http://speedtest.sng01.softlayer.com/downloads/test100.zip' 'Softlayer, Singapore, SG'
    speed_test_v6 'http://speedtest.tok02.softlayer.com/downloads/test100.zip' 'Softlayer, Tokyo, JP'
}

io_test() {
    (LANG=C dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync && rm -f test_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//'
}

calc_disk() {
    local total_size=0
    local array=$@
    for size in ${array[@]}
    do
        [ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`
        [ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' )
        [ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' )
        [ "`echo ${size:(-1)}`" == "G" ] && size=${size_t}
        total_size=$( awk 'BEGIN{printf "%.1f", '$total_size' + '$size'}' )
    done
    echo ${total_size}
}

cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' )
tram=$( free -m | awk '/Mem/ {print $2}' )
uram=$( free -m | awk '/Mem/ {print $3}' )
swap=$( free -m | awk '/Swap/ {print $2}' )
uswap=$( free -m | awk '/Swap/ {print $3}' )
up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days, %d hour %d min\n",a,b,c)}' /proc/uptime )
load=$( w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' )
opsy=$( get_opsy )
arch=$( uname -m )
lbit=$( getconf LONG_BIT )
kern=$( uname -r )
ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com )
disk_size1=($( LANG=C df -ahPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' ))
disk_size2=($( LANG=C df -ahPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' ))
disk_total_size=$( calc_disk ${disk_size1[@]} )
disk_used_size=$( calc_disk ${disk_size2[@]} )

clear
next
echo "CPU model            : $cname"
echo "Number of cores      : $cores"
echo "CPU frequency        : $freq MHz"
echo "Total size of Disk   : $disk_total_size GB ($disk_used_size GB Used)"
echo "Total amount of Mem  : $tram MB ($uram MB Used)"
echo "Total amount of Swap : $swap MB ($uswap MB Used)"
echo "System uptime        : $up"
echo "Load average         : $load"
echo "OS                   : $opsy"
echo "Arch                 : $arch ($lbit Bit)"
echo "Kernel               : $kern"
next
io1=$( io_test )
echo "I/O speed(1st run)   : $io1"
io2=$( io_test )
echo "I/O speed(2nd run)   : $io2"
io3=$( io_test )
echo "I/O speed(3rd run)   : $io3"
ioraw1=$( echo $io1 | awk 'NR==1 {print $1}' )
[ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' )
ioraw2=$( echo $io2 | awk 'NR==1 {print $1}' )
[ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' )
ioraw3=$( echo $io3 | awk 'NR==1 {print $1}' )
[ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' )
ioall=$( awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}' )
ioavg=$( awk 'BEGIN{printf "%.1f", '$ioall' / 3}' )
echo "Average I/O speed    : $ioavg MB/s"
next
printf "%-32s%-24s%-14s\n" "Node Name" "IPv4 address" "Download Speed"
speed && next