How to do a quick benchmark for your Linux server

Published in: Linux, Quick Tips

The first thing I do when I buy a new server is to run a quick benchmark to see if they are selling what they are advertising. The script I use very simple and you can wget it from Akamarus website.

The idea behind the script is very simple. The script echoes info from /proc/cpuinfo then it measures download speed by downloading a 100mb file from cachefly and then it test I/O speed by writing a 1Gb file.

Download the script:

wget http://akamaras.com/bench.sh

Content of the script:

#!/bin/bash
#written by akamaras.com

cname=$(cat /proc/cpuinfo|grep name|head -1|awk '{ $1=$2=$3=""; print }')
cores=$(cat /proc/cpuinfo|grep MHz|wc -l)
freq=$(cat /proc/cpuinfo|grep MHz|head -1|awk '{ print $4 }')
tram=$(free -m | awk 'NR==2'|awk '{ print $2 }')
swap=$(free -m | awk 'NR==4'| awk '{ print $2 }')
up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')
cache=$((wget -O /dev/null http://cachefly.cachefly.net/100mb.test) 2>&1 | tail -2 | head -1 | awk '{print $3 $4 }')
io=$( (dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync &&rm -f test_$$) 2>&1 | tail -1| awk '{ print $(NF-1) $NF }')
echo "CPU model : $cname"
echo "Number of cores : $cores"
echo "CPU frequency : $freq MHz"
echo "Total amount of ram : $tram MB"
echo "Total amount of swap : $swap MB"
echo "System uptime : $up"
echo "Download speed : $cache "
echo "I/O speed : $io"

Run the script:

bash bench.sh

This is a sample output of what information you will get:

CPU model :    Intel(R) Xeon(R) CPU W3520 @ 2.67GHz
Number of cores : 1
CPU frequency : 958.362 MHz
Total amount of ram : 2560 MB
Total amount of swap : 0 MB
System uptime :   6 days, 8:19,
Download speed : (20.7MB/s)
I/O speed : 152MB/s



about | twitter | facebook | archive | rss