Benchmark linux system cpu, disk and network with build-in commands – duguo.org

Benchmark linux system cpu, disk and network with build-in commands
Published on 2012-02-01

We quite often get chance to work on new server, before you actual do any work, it’s important to know how it perform compare with existing environment. The command used here are available on most of linux [verified on Ubuntu 11.10, CentOS 5.7] distribution by default.

But bare in mind that benchmark only give you quick overview of the environment generic performance, it doesn’t tell the performance of your application under work load. You should always run test against production like configuration to get repeatable performance number in a given environment.

Commands

CPU

time echo « scale=5000; a(1)*4 » | bc -l > /dev/null

Disk

time dd bs=1M count=5000 if=/dev/zero of=/tmp/dd.test
time dd bs=1M count=5000 if=/tmp/dd.test of=/dev/null
rm -f /tmp/dd.test

Network
Server

nc -v -l 2222 > /dev/null

Client

time dd if=/dev/zero bs=1M count=1000 | nc SERVER_HOST_NAME 2222 -v