Test MySQL performance using sysbench 0.5
In view of my recent interest and passion for OpenStack, I want to ensure that I can perform proper system performance evaluations. I mainly started to switch to sysbench because it brings a series of tests for different levels (learned through-test = option), including:
Fileio-file I/O Testing
Cpu-CPU performance test
Memory-memory function speed test
Threads-thread subsystem Energy Testing
Mutex-mutex performance test
As you can see, sysbench will focus your attention on the many basic components of your hardware and infrastructure, such as your disk subsystem, and your CPUs and memory. There is an additional option to perform a simulated stress test on MySQL, and I was surprised when I did not see the supported test items mentioned above in MySQL 0.5, although it can be used to display "online transaction processing-online transaction processing test ". -Test = oltp what is going on ??
This list is from sysbench's latest release version 0.5. If you only use it in this version, use Frederic Descamps (thanks to lefred !) The provided package.
Package:
------------------------------------------ Split line ------------------------------------------
Free in http://linux.bkjia.com/
The username and password are both www.bkjia.com
The specific download directory is in/July 0.5/July 6/July 6/. Use sysbench to test MySQL performance.
For the download method, see
------------------------------------------ Split line ------------------------------------------
If you use EPEL, Ubuntu 14.04, or Debian 7, you can use version 0.4.12 (check the sysbench version ). Then, the test Type OLTP will no longer appear. What does this version do? I scratched my head until I asked Percona IRC to know that the standard OLTP test type in version 0.5 was replaced with a different syntax. It passed parameters to sysbench, replaced by the method in which the reference script is written into lua. It has the advantage that you now have an interface that can be written to your specific load test (providing the lua interface you know), which is not difficult to use ). If you want to run a predefined load test, they still exist, but you must install them as part of the RPM or directly copy them to your system.
Fortunately, if you use the package provided by lefred, you will find the following lua scripts (Amazon ami as of January 1, August 4, 2014 is used here ):
[Root @ pxc-control ~] # Ls-l/usr/share/doc/sysbench/tests/db/
Total 44
-Rw-r -- 1 root 3585 Sep 7 2012 common. lua
-Rw-r -- 1 root 340 Sep 7 2012 delete. lua
-Rw-r -- 1 root 830 Sep 7 2012 insert. lua
-Rw-r -- 1 root 2925 Sep 7 2012 oltp. lua
-Rw-r -- 1 root 342 Sep 7 2012 oltp_simple.lua
-Rw-r -- 1 root 425 Sep 7 2012 parallel_prepare.lua
-Rw-r -- 1 root 343 Sep 7 2012 select. lua
-Rw-r -- 1 root 3964 Sep 7 2012 select_random_points.lua
-Rw-r -- 1 root 4066 Sep 7 2012 select_random_ranges.lua
-Rw-r -- 1 root 343 Sep 7 2012 update_index.lua
-Rw-r -- 1 root 552 Sep 7 2012 update_non_index.lua
So the trick (if you want to call it this way) is not to pass the -- test command through a single word, but to pass the complete path of a lua script.
The following is the old method (sysbench 0.4.12 from EPEL Library ):
-- Test = oltp -- oltp-test-mode = complex
The following is a new method (sysbench 0.5 ):
-- Test =/usr/share/doc/sysbench/tests/db/insert. lua
The following shows how to run haproxy on a three-node PXC cluster and perform a insert-only test. Below are all the commands I passed to sysbench:
[Root @ pxc-control ~] # Cat sys_haproxy.sh
#! /Bin/bash
Sysbench
-- Test =/usr/share/doc/sysbench/tests/db/insert. lua
-- Mysql-host = pxc-control
-- Mysql-port = 9999
-- Mysql-user = sysbench-haproxy
-- Mysql-password = sysbench-haproxy
-- Mysql-db = sbtest
-- Mysql-table-type = innodb
-- Oltp-test-mode = complex
-- Oltp-read-only = off
-- Oltp-reconnect = on
-- Oltp-table-size = 1000000
-- Max-requests = 100000000
-- Num-threads = 3
-- Report-interval = 1
-- Report-checkpoints = 10
-- Tx-rate = 24
$1
For more details, please continue to read the highlights on the next page: