Home PHP JavaScript CSS WordPress APIs .htaccess Other How-To Useful Scripts What I Recommend
Posted on by Aleksandar Gichevski ()
Today's applications and services require high performance servers to work properly. Especially if you have high traffic or high-usage applications hosted, then you need a machine that will keep running smoothly even in stressful periods. Testing server performance is a must when it comes to comparing different machines and deciding what to use. Using benchmark tools you can easily determine the possibilities of the server under critical conditions and examine the behavior with CPU, File IO and MySQL benchmark. In this post I will show you how to benchmark a server and test CPU, File IO and MySQL with sysbench.

What is SysBench?

SysBench is a cross-platform and multi-threaded benchmark tool that allows you to quickly get overview about server performance and OS parameters that are important if you have high resource usage application.

SysBench Features

  • File I/O Performance
  • Scheduler Performance
  • Memory Allocation and Transfer Speed
  • POSIX Threads Implementation Performance
  • Database Server Performance (OLTP Benchmark, primarily written for MySQL servers)

Install SysBench

These steps show you how to install manually SysBench on your server. I always use this way because for example in CentOS you don't have RPM and you must do it yourself. Step 1: Download SysBench
wget http://garr.dl.sourceforge.net/sourceforge/sysbench/sysbench-0.4.12.tar.gz
Step 2: Unpack the files and install it Just execute the commands one by one in SSH as below:
tar -xvzf sysbench-0.4.12.tar.gz
cd sysbench-0.4.12
libtoolize --force --copy 
make install

SysBench CPU Benchmark

You can benchmark your CPU performance as follows:
sysbench --test=cpu --cpu-max-prime=20000 run
After getting results check total time number. That is the most important value when it comes to CPU Benchmark.

SysBench File IO Benchmark

To perform File IO benchmark, first we create a test file that is much bigger than server's RAM because otherwise the results won't be accurate due to RAM caching. We create 150 GB file (in case you are using cloud hosting and your hard drive is smaller than 150 GB you can always change the size of the test file in the command):
sysbench --test=fileio --file-total-size=150G prepare
When process of creating file is completed enter below line:
sysbench --test=fileio --file-total-size=150G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
This will run File IO test and return results in a while. From the results your attention should be on transferred amount per second: Read ---Mb Written ---Mb Total transferred ---Mb (---Kb/sec) After completing the benchmark run below command to delete the 150 GB test file:
sysbench --test=fileio --file-total-size=150G cleanup

SysBench MySQL Benchmark

And at last let's perform MySQL Benchmark test. As in File IO benchmark, first we create a test table with 1 million records:
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword prepare
Change "test", "root" and "yourrootpassword" with real information about your database. When this process is completed run below command to start the MySQL benchmark Test:
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
Again make sure you update the database information. From returned results look for transactions value (----- (---.-- per sec.)) To delete the test table and clean the server run:
sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword cleanup


Combining all these 3 tests can give you good picture about a server's performance. Of course, you should compare benchmarks across multiple servers to know what server has the best performance. If you need good place for hosting your website consider BlueHost as one of the best online options for shared hosting. CLICK HERE TO SIGNUP FOR BLUEHOST.COM

Other Posts You Might Like

Get a fast, free website audit

Enter your URL below to get full in-depth SEO report and tips.


Useful Scripts

Most Popular Posts

Recent Posts

June 14th, 2014
Website Optimization Using Gzip Compression

June 10th, 2014
Google Search AutoComplete API

May 14th, 2014
What is a Tag Cloud and How to Calculate it by Formula

March 27th, 2014
Error writing file /tmp (errcode 28) Solved!

February 15th, 2014
Fixed CSS & HTML Navigation Bar

February 9th, 2014
Benchmark Your Server (CPU, File IO, MySQL) with SysBench

February 8th, 2014
JavaScript Array Basics

January 29th, 2014

January 25th, 2014
Payoneer Debit Card for Freelancers to receive money online

January 24th, 2014
How HTML Color Codes are generated?

Read Latest Posts directly on Facebook