Last active
November 7, 2018 12:19
-
-
Save shimondoodkin/defae1e5f9c1aaabb1c7 to your computer and use it in GitHub Desktop.
real vps server performance benchmark - the idea of this script is to predict performance of software
This file contains hidden or 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
#!/bin/bash | |
# if memory to memory is 0kb/s then the size is too large or problem writing /run/shm | |
# instant use: | |
# wget -O- https://gist.githubusercontent.com/shimondoodkin/defae1e5f9c1aaabb1c7/raw/bench.sh | size=150 bash | |
# wget -O- https://gist.githubusercontent.com/shimondoodkin/defae1e5f9c1aaabb1c7/raw/bench.sh | size=512 bash | |
# download then use | |
# rm bench.sh; wget -O bench.sh https://gist.githubusercontent.com/shimondoodkin/defae1e5f9c1aaabb1c7/raw/bench.sh | |
# bash bench.sh 150 # for 150 mb file in ram | |
# bash bench.sh 512 | |
# On some vpss you could find ram at ridiculously slow speed. This script helps to compare between vpss | |
# the script developed for ubuntu. it is simple: | |
# it creates a random file intentionaly because zeros are compressable | |
# so it puts a file in ram then copies it: ram to ram. ram to disk ... | |
# maybe change count=512 to count=1024 - something above burst cache levels. but fits 2 times in ram | |
sysinfo () { | |
# Reading out system information... | |
# Reading CPU model | |
cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) | |
# Reading amount of CPU cores | |
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo ) | |
# Reading CPU frequency in MHz | |
freq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) | |
# Reading total memory in MB | |
tram=$( free -m | awk 'NR==2 {print $2}' ) | |
# Reading Swap in MB | |
vram=$( free -m | awk 'NR==4 {print $2}' ) | |
# Reading system uptime | |
up=$( uptime | awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }' | sed 's/^[ \t]*//;s/[ \t]*$//' ) | |
# Reading operating system and version (simple, didn't filter the strings at the end...) | |
opsy=$( cat /etc/issue.net | awk 'NR==1 {print}' ) # Operating System & Version | |
arch=$( uname -m ) # Architecture | |
lbit=$( getconf LONG_BIT ) # Architecture in Bit | |
hn=$( hostname ) # Hostname | |
kern=$( uname -r ) | |
# Date of benchmark | |
bdates=$( date ) | |
echo " VPS Benchmark Script by Shimon Doodkin https://gist.githubusercontent.com/shimondoodkin/defae1e5f9c1aaabb1c7" | |
echo "" | |
echo "Benchmark started on $bdates" | |
echo "" | |
# Output of results | |
echo "System Info" | |
echo "" | |
echo "-----------" | |
echo "" | |
echo "Processor : $cname" | |
echo "CPU Cores : $cores" | |
echo "Frequency : $freq MHz" | |
echo "Memory : $tram MB" | |
echo "Swap : $vram MB" | |
echo "Uptime : $up" | |
echo "" | |
echo "OS : $opsy" | |
echo "Arch : $arch ($lbit Bit)" | |
echo "Kernel : $kern" | |
echo "Hostname : $hn" | |
echo "" | |
} | |
myipinfo () { | |
echo "" | |
#try get webhosting company name or information | |
myip=$( wget -qO- bot.whatismyipaddress.com ) | |
myinfo=$( wget -qO- --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" "http://whatismyipaddress.com/ip/$myip" ) | |
infohost=$( echo "$myinfo" |grep Hostname:|sed -e 's/<[^>]*>//g'| sed -e 's/^[ \t]*//'| sed -e 's/[ \t]*$//'|sed -e 's/Hostname://g'|tail -n 1 ) | |
infoisp=$( echo "$myinfo" |grep ISP:|sed -e 's/<[^>]*>//g'| sed -e 's/^[ \t]*//'| sed -e 's/[ \t]*$//'|sed -e 's/ISP://g'|tail -n 1 ) | |
infoorg=$( echo "$myinfo" |grep Organization:|sed -e 's/<[^>]*>//g'| sed -e 's/^[ \t]*//'| sed -e 's/[ \t]*$//'|sed -e 's/Organization://g'|tail -n 1 ) | |
infocontinent=$( echo "$myinfo" |grep Continent:|sed -e 's/<[^>]*>//g'| sed -e 's/^[ \t]*//'| sed -e 's/[ \t]*$//'|sed -e 's/Continent://g'|tail -n 1 ) | |
infocountry=$( echo "$myinfo" |grep Country:|sed -e 's/<[^>]*>//g'| sed -e 's/^[ \t]*//'| sed -e 's/[ \t]*$//'|sed -e 's/Country://g'|tail -n 1 ) | |
echo "Hostname rDNS : $infohost" | |
echo "ISP : $infoisp" | |
echo "Organization : $infoorg" | |
echo "Continent : $infocontinent" | |
echo "Country : $infocountry" | |
echo "" | |
} | |
prefbench () { | |
# change filesize to maybe 1024 - something above burst cache levels. but fits twise in ram | |
if [ -z "$1" ] | |
then | |
filesize=512 | |
else | |
filesize=$1 | |
fi | |
echo "benchmark, takes about 3 minutes" | |
echo "filesize = $filesize" | |
echo "(cpu = /dev/urandom)" | |
ddresult=$( dd if=/dev/urandom iflag=fullblock bs=1M count=$filesize of=/run/shm/diskbench 2>&1|tail -n 1|sed -e 's/^.*, //g' ) | |
echo "cpu to memory $ddresult" | |
ddresult=$( dd if=/run/shm/diskbench bs=1M count=$filesize of=/run/shm/diskbench2 conv=fdatasync 2>&1|tail -n 1|sed -e 's/^.*, //g' ) | |
echo "memory to memory $ddresult" | |
ddresult=$( dd if=/run/shm/diskbench bs=1M count=$filesize of=diskbench conv=fdatasync 2>&1|tail -n 1|sed -e 's/^.*, //g' ) | |
echo "memory to disk $ddresult" | |
ddresult=$( dd if=/dev/urandom iflag=fullblock bs=1M count=100 of=diskbench conv=fdatasync 2>&1|tail -n 1|sed -e 's/^.*, //g' ) | |
echo "cpu to disk $ddresult" | |
rm diskbench /run/shm/diskbench2 /run/shm/diskbench | |
} | |
if [ -z "$1" ] | |
then | |
if [ -z "$size" ] | |
then | |
largefilesize=150 | |
else | |
largefilesize=$size | |
fi | |
else | |
largefilesize=$1 | |
fi | |
#sysinfo ; myipinfo ; echo "fast results"; prefbench 20 ; echo "" ; echo "slow results" ; prefbench $largefilesize | |
sysinfo ; myipinfo ; prefbench $largefilesize | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VPS Benchmark Script by Shimon Doodkin https://gist.githubusercontent.com/shimondoodkin/defae1e5f9c1aaabb1c7
Benchmark started on Wed Nov 7 12:16:13 UTC 2018
System Info
Processor : Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
CPU Cores : 2
Frequency : 2299.935 MHz
Memory : 3945 MB
Swap : 0 MB
Uptime : 2:02,
OS : Amazon Linux AMI release 2018.03
Arch : x86_64 (64 Bit)
Kernel : 4.14.62-65.117.amzn1.x86_64
Hostname : *
Hostname rDNS : ec2-*.eu-central-1.compute.amazonaws.com
ISP : Amazon.com
Organization : Amazon.com
Continent : Europe
Country : Germany
benchmark, takes about 3 minutes
filesize = 150
(cpu = /dev/urandom)
cpu to memory 192 MB/s
memory to memory 1.8 GB/s
memory to disk 99.9 MB/s
cpu to disk 64.8 MB/s
benchmark, takes about 3 minutes
filesize = 512
(cpu = /dev/urandom)
cpu to memory 194 MB/s
memory to memory 1.9 GB/s
memory to disk 70.7 MB/s
cpu to disk 66.7 MB/s
filesize = 1024
(cpu = /dev/urandom)
cpu to memory 193 MB/s
memory to memory 1.9 GB/s
memory to disk 67.5 MB/s
cpu to disk 69.6 MB/s