A really short instruction for haw to test your CPU, File IO and MySQL on CentOS 6.5
1. Install sysbench
It’s easy and there is a RPM package in repositories
yum install sysbench
2. CPU benchmark
sysbench --test=cpu --cpu-max-prime=10000 run
This will benchmark your CPU performance. Only 1 thread will be used, or you can specify more the on with –num-threads=n option. Important part of the report is total time
3. File IO benchmark
At first we need to create a test file bigger than your RAM to avoid caching
sysbench --test=fileio --file-total-size=250G prepare
And to start our test
sysbench --test=fileio --file-total-size=250G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
After the test, you can delete this file
sysbench --test=fileio --file-total-size=250G cleanup
Important part of the report is Mb/sec value
4. MySQL benchmark
First you need an empty database to run test on it, let’s call it benchmark and we will insert there 1 000 000 rows. Note: in some versions of sysbench we need also to add –db-driver=mysql
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=benchmark --mysql-user=user --mysql-password=password prepare
To run the 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, you can specify more or less treats, depending on your system with –num-threads=n. The important number is the transactions per second value.
To Clean up your test database
sysbench --test=oltp --mysql-db=benchmark --mysql-user=user --mysql-password=password cleanup