How To Benchmark Your System (CPU, File IO, MySQL) With sysbench
How To Benchmark Your System (CPU, File IO, MySQL) With sysbenchVersion 1.0 sysbench is a 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. This article explains how to benchmark your CPU, file IO, and MySQL performance with sysbench. I do not issue any guarantee that this will work for you!
1 Installing sysbenchOn Debian/Ubuntu, sysbench can be installed as follows: apt-get install sysbench Take a look at man sysbench to learn more about its parameters. I will now perform simple three basic tests which tell you more about your CPU performance, file IO performance, and MySQL performance.
2 CPU BenchmarkYou can benchmark your CPU performance as follows: sysbench --test=cpu --cpu-max-prime=20000 run root@server1:~# sysbench --test=cpu --cpu-max-prime=20000 run You see a lot of numbers, the most important of it is the total time: total time: 23.8724s Of course, you must compare benchmarks across multiple systems to know what these numbers are worth.
3 File IO BenchmarkTo measure file IO performance, we first need to create a test file that is much bigger than your RAM (because otherwise the system will use RAM for caching which tampers with the benchmark results) - 150GB is a good value: sysbench --test=fileio --file-total-size=150G prepare Afterwards, we can 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 The important number is the Kb/sec value: Read 9.375Mb Written 6.25Mb Total transferred 15.625Mb (53.316Kb/sec) After the benchmark, you can delete the 150GB test file from the system: sysbench --test=fileio --file-total-size=150G cleanup
4 MySQL BenchmarkTo measure MySQL performance, we first create a test table in the database test with 1,000,000 rows of data: 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 No DB drivers specified, using mysql Afterwards, you can run the MySQL benchmark as follows: 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 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
5 Links
|




Recent comments
6 hours 51 min ago
16 hours 19 min ago
17 hours 9 min ago
20 hours 42 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 3 hours ago
1 day 13 hours ago
1 day 18 hours ago
1 day 20 hours ago