Sysbench is a modular, cross-platform, multithreaded benchmarking tool that is used to assess the load of databases under various system parameters. For more information on this project, please see: http://sysbench.sourceforge.net.
It mainly includes the following kinds of tests:
1, CPU performance
2. Disk IO Performance
3. Performance of Dispatcher Program
4, memory allocation and transmission speed
5, POSIX threading performance
6. Database performance (OLTP benchmark)
At present, the Sysbench mainly support mysql,pgsql,oracle 3 kinds of databases.
First, installation
First, download the source package in Http://sourceforge.net/projects/sysbench
But the installation process twists, all sorts of not smooth
Installation does not go as follows;
Tar zxf sysbench-0.4.12.tar.gz
CD sysbench-0.4.12
./autogen.sh
./configure--with-mysql-includes=/usr/local/mysql/include--with-mysql-libs=/usr/local/mysql/lib && make && make Install
Server terminated with error (1). Closing log file.
.. /libtool:line 2415:xsysbench:command not found
.. /libtool:line 2550:x-lmysqlclient_r:command not found
.. /libtool:line 2550:x-lrt:command not found
.. /libtool:line 2550:x-lm:command not found
.. /libtool:line 2632:x-l/root/sysbench-0.4.12/sysbench:no such file or directory
.. /libtool:line 2550:x-lmysqlclient_r:command not found
.. /libtool:line 2550:x-lrt:command not found
.. /libtool:line 2550:x-lm:command not found
.. /libtool:line 2632:x-l/root/sysbench-0.4.12/sysbench:no such file or directory
.. /libtool:line 2550:x-lmysqlclient_r:command not found
.. /libtool:line 2550:x-lrt:command not found
.. /libtool:line 2550:x-lm:command not found
The error, after various searches
Indicates Libtool version low
cp/usr/bin/libtool/path/to/sysbench_source/
That is, copy system Libtool to Sysbench source directory can solve the above problems
In addition, if you want Sysbench to support pgsql/oracle, you need to add parameters at compile time.
--with-pgsql
Or
--with-oracle
These 2 parameters are turned off by default, and only MySQL is supported by default.
[Root@zgqiang sysbench-0.4.12]# Cp/usr/bin/libtool.
CP: Overwrite "./libtool". Y
[Root@zgqiang sysbench-0.4.12]# make && make install
Compile correctly through
[Root@zgqiang sysbench-0.4.12]# Sysbench
Sysbench:error while loading shared libraries:libmysqlclient.so.18:cannot open Shared object file:no such file or dire Ctory
[Root@zgqiang sysbench-0.4.12]# vim/etc/profile #使用该脚本设置LD_LIBRARY_PATH来解决sysbench找不到mysql的lib的问题 export ld_library _path=/usr/local/mysql/lib
[Root@zgqiang sysbench-0.4.12]# Source/etc/profile
[Root@zgqiang sysbench-0.4.12]# Sysbench
Missing required command argument.
Usage:
Sysbench [general-options] ...--test=<test-name> [test-options] ... command
General Options:
--num-threads=n number of threads to use [1]
--max-requests=n limit for total number of requests [10000]
--max-time=n limit for total execution time in seconds [0]
--forced-shutdown=string amount of time to before--max-time before forcing shutdown [off]
--thread-stack-size=size size of stack per thread [32K]
--init-rng=[on|off] Initialize random number generator [off]
--test=string Test to run
--debug=[on|off] Print more debugging info [off]
--validate=[on|off] Perform validation checks where possible [off]
--help=[on|off] Print help and exit
--version=[on|off] Print version and exit
Compiled-in Tests:
Fileio-file I/O test
CPU-CPU Performance Test
Memory-memory Functions Speed Test
Threads-threads Subsystem Performance Test
Mutex-mutex Performance Test
OLTP-OLTP Test
Commands:prepare Run Cleanup Help version
"Sysbench--test=<name> Help" for the a list of options for each test.
It's running fine.
to test
After the compile installation is successful, you can start performance testing. There are a lot of methods and options for testing, and here's a general introduction to the relevant commands and options.
CPU Performance Test
Sysbench--TEST=CPU--cpu-max-prime=5000 Run
CPU performance testing mainly through the operation of prime numbers,--cpu-max-prime used to specify the largest number of options, specific parameters can be set according to the performance of the CPU.
Memory Performance Test
Sysbench--test=memory--memory-block-size=8k--memory-total-size=4g Run
--MEMORY-BLOCK-SIZE specifies the size of each block,--memory-total-size specifies the total amount of traffic, and other options that can be viewed by command sysbench–test=memory help.
disk I/O performance Test
First build the file that needs to be tested
Sysbench--test=fileio--num-threads=16--file-num=2--file-total-size=2g--FILE-TEST-MODE=RNDRW Prepare
And then execute the test.
Sysbench--test=fileio--num-threads=16--file-num=2--file-total-size=2g--FILE-TEST-MODE=RNDRW Run
Final cleanup test file
Sysbench--test=fileio--num-threads=16--file-num=2--file-total-size=2g--FILE-TEST-MODE=RNDRW Cleanup
--NUM-THREADS Specifies the maximum number of threads created,--file-num specifies the number of files,--file-taotal-size specifies the total size of the file created,--file-test-mode specifies the file read/write mode, RNDRW is randomly read,- FILE-RW-RATIO Specifies the read/write ratio. There are additional options available for viewing with command Sysbench–test=fileio help.
Threading Test
Sysbench--test=threads--num-threads=32--thread-yields=100--thread-locks=2 Run
--NUM-THREADS Specifies the number of threads,--thread-yield specifies the pressure per request,--thread-locks specifies the number of locks per thread.
Database Performance Testing
First, prepare the test data
Sysbench--test=oltp--mysql-host=server1--mysql-user=root--mysql-password=mysqlpassword--mysql-db=test-- Oltp-table-name=sbtest--mysql-table-engine=myisam--oltp-table-size=1000000 Prepare
And then execute the test.
Sysbench--test=oltp--mysql-host=server1--mysql-port=3306--mysql-user=root--mysql-password=mysqlpassword-- Mysql-db=test--oltp-table-name=sbtest--mysql-table-engine=myisam--mysql-engine-trx=no--oltp-skip-trx=on-- oltp-table-size=1000000--max-requests=1000--num-threads=100 Run
Finally clean up the test data
Sysbench--test=oltp--mysql-host=server1--mysql-user=root--mysql-password=mysqlpassword--mysql-db=test-- Oltp-table-name=sbtest cleanup
The
--mysql-host specifies the address of the MySQL server to use,--mysql-user specify the username to connect to MySQL,--mysql-password specify a password, and--mysql-db specify the database to use-- OLTP-TABLE-NAME Specifies the table to use,--mysql-table-engine the database engine used by the specified table,--mysql-engine-trx whether the database engine used is a transaction- OLTP-SKIP-TRX Specifies whether the transaction statement (BEGIN/COMMIT) is ignored,--oltp-table-size the number of records in the specified datasheet,--max-requests specify the maximum number of requests,--num-threads specify the number of threads, Additional options can be viewed using the command SYSBENCH–TEST=OLTP Help.