From the sysbench homepage “SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load.”

You can quickly get a benchmark of system performance without setting up complex database benchmarks or without using a database at all. We can quickly get the following information

  • file i/o performance
  • scheduler performance
  • memory allocation and transfer speed
  • POSIX threads implementation performance
  • database server performance (OLTP benchmark)

Installing sysbench on CentOS

RPM packages for sysbench are available in the percona-release yum repository and the EPEL repo. The percona-release repo will have a more current version available.

Once you have one of these repos setup, you can install with yum.

yum -y install sysbench

Test CPU with sysbench

Test your CPU with sysbench.

sysbench --test=cpu --cpu-max-prime=10000 run

Test MySQL db with sysbench

Create test db in mysql

echo "create database sbtest;" | mysql -uroot -p
echo "grant all on sbtest.* to testdb@localhost identified by 'testpw';" | mysql -uroot -p
echo "flush privileges;" | mysql -uroot -p

Prepare testing database

sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --mysql-table-engine=innodb --oltp-table-size=250000 --mysql-user=testdb --mysql-password=testpw --mysql-socket=/var/lib/mysql/mysql.sock prepare

Run a read test

sysbench --num-threads=16 --max-requests=500000 --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=250000 --mysql-socket=/var/lib/mysql/mysql.sock --oltp-read-only --mysql-user=testdb --mysql-password=testpw run

Run a read/write test

sysbench --num-threads=16 --max-requests=5000 --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=250000 --mysql-socket=/var/lib/mysql/mysql.sock --oltp-test-mode=complex --mysql-user=testdb --mysql-password=testpw run