Benchmark Your System CPU, File IO, MySQL

Benchmark suite which allows you to quickly get an impression about system performance which is important if you plan to run a database under intensive load.

not issue any guarantee that this will work for you

1 Installing sysbench

Debian/Ubuntu, sysbench can be installed

apt-get install sysbench

a look

man sysbench

2 CPU Benchmark

benchmark your CPU performance

sysbench –test=cpu –cpu-max-prime=20000 run

root@server1:~# sysbench –test=cpu –cpu-max-prime=20000 run
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000

Test execution summary:
total time:                          23.8724s
total number of events:              10000
total time taken by event execution: 23.8716
per-request statistics:
min:                                  2.31ms
avg:                                  2.39ms
max:                                  6.39ms
approx.  95 percentile:               2.44ms

Threads fairness:
events (avg/stddev):           10000.0000/0.00
execution time (avg/stddev):   23.8716/0.00

root@server1:~#

You see a lot of numbers, the most important of it is the total time:

total time:                          23.8724s

File IO Benchmark

measure file IO performance

sysbench –test=fileio –file-total-size=150G prepare

run the benchmark

sysbench –test=fileio –file-total-size=150G –file-test-mode=rndrw –init-rng=on –max-time=300 –max-requests=0 run

root@server1:~# sysbench –test=fileio –file-total-size=150G –file-test-mode=rndrw –init-rng=on –max-time=300 –max-requests=0 run
sysbench: /usr/lib/libmysqlclient.so.18: no version information available (required by sysbench)
sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from timer.

Extra file open flags: 0
128 files, 1.1719Gb each
150Gb total file size
Block size 16Kb
Number of random requests for random IO: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Threads started!
Time limit exceeded, exiting…
Done.

Operations performed:  600 Read, 400 Write, 1186 Other = 2186 Total
Read 9.375Mb  Written 6.25Mb  Total transferred 15.625Mb  (53.316Kb/sec)
3.33 Requests/sec executed

Test execution summary:
total time:                          300.0975s
total number of events:              1000
total time taken by event execution: 158.7611
per-request statistics:
min:                                  0.01ms
avg:                                158.76ms
max:                               2596.96ms
approx.  95 percentile:             482.29ms

Threads fairness:
events (avg/stddev):           1000.0000/0.00
execution time (avg/stddev):   158.7611/0.00

root@server1:~#

The important number is the Kb/sec value:

Read 9.375Mb  Written 6.25Mb  Total transferred 15.625Mb  (53.316Kb/sec)

delete the 150GB test file from the system

sysbench --test=fileio --file-total-size=150G cleanup

4 MySQL Benchmark

measure MySQL performance

sysbench –test=oltp –oltp-table-size=1000000 –mysql-db=test –mysql-user=root –mysql-password=yourrootsqlpassword prepare

root@server1:~# sysbench –test=oltp –oltp-table-size=1000000 –mysql-db=test –mysql-user=root –mysql-password=yourrootsqlpassword prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysql
Creating table ‘sbtest’…
Creating 1000000 records in table ‘sbtest’…
root@server1:~#

run the MySQL benchmark

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

root@server1:~# 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
sysbench 0.4.12:  multi-threaded system evaluation benchmark

No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 8

Doing OLTP test.
Running mixed OLTP test
Doing read-only test
Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
Using “BEGIN” for starting transactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting…
(last message repeated 7 times)
Done.

OLTP test statistics:
queries performed:
read:                            2253860
write:                           0
other:                           321980
total:                           2575840
transactions:                        160990 (2683.06 per sec.)
deadlocks:                           0      (0.00 per sec.)
read/write requests:                 2253860 (37562.81 per sec.)
other operations:                    321980 (5366.12 per sec.)

Test execution summary:
total time:                          60.0024s
total number of events:              160990
total time taken by event execution: 479.3419
per-request statistics:
min:                                  0.81ms
avg:                                  2.98ms
max:                               3283.40ms
approx.  95 percentile:               4.62ms

Threads fairness:
events (avg/stddev):           20123.7500/63.52
execution time (avg/stddev):   59.9177/0.00

root@server1:~#

The important number is the transactions per second value:

transactions:                        160990 (2683.06 per sec.)

To clean up the system afterwards (i.e., remove the test table), run:

sysbench –test=oltp –mysql-db=test –mysql-user=root –mysql-password=yourrootsqlpassword cleanup

Leave a comment