Skip to content

Instantly share code, notes, and snippets.

@shimondoodkin
Last active November 7, 2018 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shimondoodkin/defae1e5f9c1aaabb1c7 to your computer and use it in GitHub Desktop.
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
#!/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
@shimondoodkin
Copy link
Author


amazon mini

Benchmark started on Wed Jan 27 11:51:39 UTC 2016

System Info


Processor : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
CPU Cores : 1
Frequency : 2500.064 MHz
Memory : 992 MB
Swap : 4095 MB
Uptime : 90 days, 22:48,

OS : Ubuntu 14.04.2 LTS
Arch : x86_64 (64 Bit)
Kernel : 3.13.0-44-generic
Hostname : ....

Hostname rDNS : ec2-...eu-west-1.compute.amazonaws.com
ISP : Amazon Technologies
Organization : Amazon.com
Continent : Europe
Country : Ireland

benchmark, takes about 3 minutes
filesize = 150
(cpu = /dev/urandom)
cpu to memory 10.5 MB/s
memory to memory 79.5 MB/s
memory to disk 50.2 MB/s
cpu to disk 10.8 MB/s

@shimondoodkin
Copy link
Author

digital ocean ssd

Benchmark started on Wed Jan 27 11:51:23 UTC 2016

System Info


Processor : Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
CPU Cores : 2
Frequency : 2399.998 MHz
Memory : 2001 MB
Swap : 4699 MB
Uptime : 237 days, 7:32,

OS : Ubuntu 14.04.3 LTS
Arch : x86_64 (64 Bit)
Kernel : 3.16.0-37-generic
Hostname : ........com

Hostname rDNS : .....com
ISP : Digital Ocean
Organization : Digital Ocean
Continent : Europe
Country : Netherlands

benchmark, takes about 3 minutes
filesize = 150
(cpu = /dev/urandom)
cpu to memory 8.3 MB/s
memory to memory 355 MB/s
memory to disk 281 MB/s
cpu to disk 7.2 MB/s

@shimondoodkin
Copy link
Author

anazon lightsnail hvm - hardware virtualization
2018-08-19 18:19:32 (1.85 MB/s) - written to stdout [5362/5362]

VPS Benchmark Script by Shimon Doodkin https://gist.githubusercontent.com/shimo ndoodkin/defae1e5f9c1aaabb1c7

Benchmark started on Sun Aug 19 18:19:33 UTC 2018

System Info


Processor : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
CPU Cores : 1
Frequency : 2400.078 MHz
Memory : 479 MB
Swap : MB
Uptime : 7 min,

OS : Ubuntu 18.04.1 LTS
Arch : x86_64 (64 Bit)
Kernel : 4.15.0-1019-aws
Hostname : ip-***

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 176 MB/s
memory to memory 730 MB/s
memory to disk 107 MB/s
cpu to disk 65.0 MB/s

@shimondoodkin
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment