Linux Benchmark Script


This is a handy script I've used in the past to benchmark a Linux server.  It's helpful when you want to compare the performance between 2 systems.
#!/bin/bash
#basic benchmark script
echo "Running basic benchmark against "$HOSTNAME

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 }')
echo "Downloading Test File....."
cache=$((wget --no-check-certificate -O /dev/null https://google.com/somelargetestfile) 2>&1 | tail -2 | head -1 | awk '{print $3 $4 }')
echo "Testing I/O...."
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 "Testing CPU...."
cpustart=$(date +"%s"); i=0; while (( i < 2000000 )); do (( i ++ )); done; cpufinish=$(date +"%s"); diff=$(($cpufinish-$cpustart))
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"
echo "cpu counter time in seconds : $diff seconds"
You may need to install wget but all other binaries used are stock in most Linux distros. Don't forget to update the url from google to something more preferable.

Comments

  1. Thanks and Regards. Oracle Apps R12 Training Videos at affordable cost. please check oracleappstechnical.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Active Directory Authentication with an Oracle Database

Create a custom backup report with BI Publisher for Oracle Enterprise Manager/Cloud Control 13c

Oracle Enterprise Manager notify when Recovery Area low