壓力測試sysbench安裝及引數介紹

許願流星1號發表於2015-12-02

一、sysbench壓力測試工具簡介:

 

sysbench是一個開源的、模組化的、跨平臺的多執行緒效能測試工具,可以用來進行CPU、記憶體、磁碟I/O、執行緒、資料庫的效能測試。目前支援的資料庫有MySQL、Oracle和PostgreSQL。以下操作都將以支援MySQL資料庫為例進行。

 

1.      sysbench工具安裝:

預設支援MySQL,如果需要測試Oracle/PostgreSQL,則在configure時需要加上–with-oracle或者–with-pgsql引數.

1.1          安裝環境

CentOS release 6.3 (Final) 以及  redhat5.5

MySQL 5.6.13 以及  5.6.24

MySQL_HOME=/usr/local/mysql/

Sysbench 0.4.12

1.2          下載安裝包

# wget 

 

1.3 編譯安裝

#  tar –zxvf sysbench-0.4.12.tar.gz

進入解壓縮包sysbench-0.4.12,並執行指令碼autogen.sh

# cd sysbench-0.4.12

# ./autogen.sh

關鍵的三步:configure && make && make install

首先是./configure命令,sysbench預設是支援MySQL的benchmarking的,如果不加任何選項則要求保證MySQL的安裝路徑都是預設的標準路徑,headfile位於/usr/include目錄下,libraries位於/usr/lib/目錄下。因為我的MySQL是原始碼編譯安裝的,安裝路徑是放在/usr/local/mysql下,所以這裡要新增相應的選項命令:

 

 

[root@wg2 ~]# find / -name mysql

/usr/lib64/mysql

/usr/bin/mysql

/usr/share/mysql

/usr/include/mysql

/usr/include/mysql/mysql

/etc/logrotate.d/mysql

/etc/rc.d/init.d/mysql

/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql

/var/lib/mysql

/var/lib/mysql/mysql

/var/lock/subsys/mysql

 

 

[root@wg2 sysbench-0.4.12]# ./configure --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/var/lib/mysql

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking whether to compile with MySQL support... (cached) yes

checking whether to compile with Oracle support... (cached) no

checking whether to compile with PostgreSQL support... (cached) no

checking for style of include used by make... GNU

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking dependency style of gcc... gcc3

checking whether SHM_HUGETLB is declared... yes

checking whether O_SYNC is declared... yes

checking for gcc... (cached) gcc

checking whether we are using the GNU C compiler... (cached) yes

checking whether gcc accepts -g... (cached) yes

checking for gcc option to accept ANSI C... (cached) none needed

checking dependency style of gcc... (cached) gcc3

checking for a sed that does not truncate output... /bin/sed

checking for egrep... grep -E

checking for ld used by gcc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognise dependent libraries... pass_all

checking how to run the C preprocessor... gcc -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking dlfcn.h usability... yes

checking dlfcn.h presence... yes

checking for dlfcn.h... yes

checking for g++... g++

checking whether we are using the GNU C++ compiler... yes

checking whether g++ accepts -g... yes

checking dependency style of g++... gcc3

checking how to run the C++ preprocessor... g++ -E

checking for g77... g77

checking whether we are using the GNU Fortran 77 compiler... yes

checking whether g77 accepts -g... yes

checking the maximum length of command line arguments... 32768

checking command to parse /usr/bin/nm -B output from gcc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if gcc supports -fno-rtti -fno-exceptions... no

checking for gcc option to produce PIC... -fPIC

checking if gcc PIC flag -fPIC works... yes

checking if gcc static flag -static works... yes

checking if gcc supports -c -o file.o... yes

checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

configure: creating libtool

appending configuration tag "CXX" to libtool

checking for ld used by g++... /usr/bin/ld -m elf_x86_64

checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes

checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

checking for g++ option to produce PIC... -fPIC

checking if g++ PIC flag -fPIC works... yes

checking if g++ static flag -static works... yes

checking if g++ supports -c -o file.o... yes

checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

appending configuration tag "F77" to libtool

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

checking for g77 option to produce PIC... -fPIC

checking if g77 PIC flag -fPIC works... yes

checking if g77 static flag -static works... yes

checking if g77 supports -c -o file.o... yes

checking whether the g77 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking for xsltproc... xsltproc

checking whether xsltproc works... yes

checking for the pthreads library -lpthreads... no

checking whether pthreads work without any flags... no

checking whether pthreads work with -Kthread... no

checking whether pthreads work with -kthread... no

checking for the pthreads library -llthread... no

checking whether pthreads work with -pthread... yes

checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE

checking if more special flags are required for pthreads... no

checking for cc_r... gcc

checking for sqrt in -lm... yes

checking MySQL includes... (cached) /usr/include/mysql/

checking MySQL libraries... (cached) /var/lib/mysql

checking libaio.h usability... no

checking libaio.h presence... no

checking for libaio.h... no

checking for malloc in -lumem... no

checking for malloc in -lmtmalloc... no

checking for ANSI C header files... (cached) yes

checking errno.h usability... yes

checking errno.h presence... yes

checking for errno.h... yes

checking fcntl.h usability... yes

checking fcntl.h presence... yes

checking for fcntl.h... yes

checking math.h usability... yes

checking math.h presence... yes

checking for math.h... yes

checking pthread.h usability... yes

checking pthread.h presence... yes

checking for pthread.h... yes

checking sched.h usability... yes

checking sched.h presence... yes

checking for sched.h... yes

checking signal.h usability... yes

checking signal.h presence... yes

checking for signal.h... yes

checking for stdlib.h... (cached) yes

checking for string.h... (cached) yes

checking sys/aio.h usability... no

checking sys/aio.h presence... no

checking for sys/aio.h... no

checking sys/ipc.h usability... yes

checking sys/ipc.h presence... yes

checking for sys/ipc.h... yes

checking sys/time.h usability... yes

checking sys/time.h presence... yes

checking for sys/time.h... yes

checking sys/mman.h usability... yes

checking sys/mman.h presence... yes

checking for sys/mman.h... yes

checking sys/shm.h usability... yes

checking sys/shm.h presence... yes

checking for sys/shm.h... yes

checking thread.h usability... no

checking thread.h presence... no

checking for thread.h... no

checking for unistd.h... (cached) yes

checking for inline... inline

checking for off_t... yes

checking for size_t... yes

checking whether time.h and sys/time.h may both be included... yes

checking for special C compiler options needed for large files... no

checking for _FILE_OFFSET_BITS value needed for large files... no

checking for _LARGE_FILES value needed for large files... no

checking for size_t... (cached) yes

checking size of size_t... 8

checking for stdlib.h... (cached) yes

checking for GNU libc compatible malloc... yes

checking for stdlib.h... (cached) yes

checking for unistd.h... (cached) yes

checking for getpagesize... yes

checking for working mmap... yes

checking whether strerror_r is declared... yes

checking for strerror_r... yes

checking whether strerror_r returns char *... no

checking whether clock_gettime is declared... yes

checking for library containing clock_gettime... -lrt

checking for alarm... yes

checking for fdatasync... yes

checking for gettimeofday... yes

checking for lrand48... yes

checking for memalign... yes

checking for memset... yes

checking for posix_memalign... yes

checking for pthread_yield... yes

checking for setvbuf... yes

checking for sqrt... yes

checking for strdup... yes

checking for thr_setconcurrency... no

checking for valloc... yes

configure: creating ./config.status

config.status: creating Makefile

config.status: creating doc/xsl/Makefile

config.status: creating doc/xsl/catalog.xml

config.status: creating doc/Makefile

config.status: creating sysbench/Makefile

config.status: creating sysbench/drivers/Makefile

config.status: creating sysbench/drivers/mysql/Makefile

config.status: creating sysbench/drivers/oracle/Makefile

config.status: creating sysbench/drivers/pgsql/Makefile

config.status: creating sysbench/tests/Makefile

config.status: creating sysbench/tests/cpu/Makefile

config.status: creating sysbench/tests/fileio/Makefile

config.status: creating sysbench/tests/memory/Makefile

config.status: creating sysbench/tests/threads/Makefile

config.status: creating sysbench/tests/mutex/Makefile

config.status: creating sysbench/tests/oltp/Makefile

config.status: creating config/config.h

config.status: executing depfiles commands

[root@wg2 sysbench-0.4.12]# make

Making all in doc

make[1]: Entering directory `/mysql_log/sysbench-0.4.12/doc'

Making all in xsl

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[2]: Nothing to be done for `all'.

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/doc'

make[2]: Nothing to be done for `all-am'.

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/doc'

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12/doc'

Making all in sysbench

make[1]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench'

Making all in drivers

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

Making all in mysql

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -I/usr/include/mysql/ -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmysql_a-drv_mysql.o -MD -MP -MF ".deps/libsbmysql_a-drv_mysql.Tpo" -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c; \

        then mv -f ".deps/libsbmysql_a-drv_mysql.Tpo" ".deps/libsbmysql_a-drv_mysql.Po"; else rm -f ".deps/libsbmysql_a-drv_mysql.Tpo"; exit 1; fi

rm -f libsbmysql.a

ar cru libsbmysql.a libsbmysql_a-drv_mysql.o

ranlib libsbmysql.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[3]: Nothing to be done for `all-am'.

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

Making all in tests

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

Making all in cpu

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbcpu_a-sb_cpu.o -MD -MP -MF ".deps/libsbcpu_a-sb_cpu.Tpo" -c -o libsbcpu_a-sb_cpu.o `test -f 'sb_cpu.c' || echo './'`sb_cpu.c; \

        then mv -f ".deps/libsbcpu_a-sb_cpu.Tpo" ".deps/libsbcpu_a-sb_cpu.Po"; else rm -f ".deps/libsbcpu_a-sb_cpu.Tpo"; exit 1; fi

rm -f libsbcpu.a

ar cru libsbcpu.a libsbcpu_a-sb_cpu.o

ranlib libsbcpu.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

Making all in fileio

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbfileio_a-sb_fileio.o -MD -MP -MF ".deps/libsbfileio_a-sb_fileio.Tpo" -c -o libsbfileio_a-sb_fileio.o `test -f 'sb_fileio.c' || echo './'`sb_fileio.c; \

        then mv -f ".deps/libsbfileio_a-sb_fileio.Tpo" ".deps/libsbfileio_a-sb_fileio.Po"; else rm -f ".deps/libsbfileio_a-sb_fileio.Tpo"; exit 1; fi

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbfileio_a-crc32.o -MD -MP -MF ".deps/libsbfileio_a-crc32.Tpo" -c -o libsbfileio_a-crc32.o `test -f 'crc32.c' || echo './'`crc32.c; \

        then mv -f ".deps/libsbfileio_a-crc32.Tpo" ".deps/libsbfileio_a-crc32.Po"; else rm -f ".deps/libsbfileio_a-crc32.Tpo"; exit 1; fi

rm -f libsbfileio.a

ar cru libsbfileio.a libsbfileio_a-sb_fileio.o libsbfileio_a-crc32.o

ranlib libsbfileio.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

Making all in memory

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmemory_a-sb_memory.o -MD -MP -MF ".deps/libsbmemory_a-sb_memory.Tpo" -c -o libsbmemory_a-sb_memory.o `test -f 'sb_memory.c' || echo './'`sb_memory.c; \

        then mv -f ".deps/libsbmemory_a-sb_memory.Tpo" ".deps/libsbmemory_a-sb_memory.Po"; else rm -f ".deps/libsbmemory_a-sb_memory.Tpo"; exit 1; fi

rm -f libsbmemory.a

ar cru libsbmemory.a libsbmemory_a-sb_memory.o

ranlib libsbmemory.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

Making all in threads

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbthreads_a-sb_threads.o -MD -MP -MF ".deps/libsbthreads_a-sb_threads.Tpo" -c -o libsbthreads_a-sb_threads.o `test -f 'sb_threads.c' || echo './'`sb_threads.c; \

        then mv -f ".deps/libsbthreads_a-sb_threads.Tpo" ".deps/libsbthreads_a-sb_threads.Po"; else rm -f ".deps/libsbthreads_a-sb_threads.Tpo"; exit 1; fi

rm -f libsbthreads.a

ar cru libsbthreads.a libsbthreads_a-sb_threads.o

ranlib libsbthreads.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

Making all in mutex

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench  -pthread -g -O2 -MT libsbmutex_a-sb_mutex.o -MD -MP -MF ".deps/libsbmutex_a-sb_mutex.Tpo" -c -o libsbmutex_a-sb_mutex.o `test -f 'sb_mutex.c' || echo './'`sb_mutex.c; \

        then mv -f ".deps/libsbmutex_a-sb_mutex.Tpo" ".deps/libsbmutex_a-sb_mutex.Po"; else rm -f ".deps/libsbmutex_a-sb_mutex.Tpo"; exit 1; fi

rm -f libsbmutex.a

ar cru libsbmutex.a libsbmutex_a-sb_mutex.o

ranlib libsbmutex.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

Making all in oltp

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config  -I./.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../../../sysbench -I/usr/include/mysql/  -pthread -g -O2 -MT libsboltp_a-sb_oltp.o -MD -MP -MF ".deps/libsboltp_a-sb_oltp.Tpo" -c -o libsboltp_a-sb_oltp.o `test -f 'sb_oltp.c' || echo './'`sb_oltp.c; \

        then mv -f ".deps/libsboltp_a-sb_oltp.Tpo" ".deps/libsboltp_a-sb_oltp.Po"; else rm -f ".deps/libsboltp_a-sb_oltp.Tpo"; exit 1; fi

rm -f libsboltp.a

ar cru libsboltp.a libsboltp_a-sb_oltp.o

ranlib libsboltp.a

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[3]: Nothing to be done for `all-am'.

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

Making all in .

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench'

if gcc -DHAVE_CONFIG_H -I. -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sysbench.o -MD -MP -MF ".deps/sysbench.Tpo" -c -o sysbench.o sysbench.c; \

        then mv -f ".deps/sysbench.Tpo" ".deps/sysbench.Po"; else rm -f ".deps/sysbench.Tpo"; exit 1; fi

if gcc -DHAVE_CONFIG_H -I. -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_timer.o -MD -MP -MF ".deps/sb_timer.Tpo" -c -o sb_timer.o sb_timer.c; \

        then mv -f ".deps/sb_timer.Tpo" ".deps/sb_timer.Po"; else rm -f ".deps/sb_timer.Tpo"; exit 1; fi

if gcc -DHAVE_CONFIG_H -I. -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_options.o -MD -MP -MF ".deps/sb_options.Tpo" -c -o sb_options.o sb_options.c; \

        then mv -f ".deps/sb_options.Tpo" ".deps/sb_options.Po"; else rm -f ".deps/sb_options.Tpo"; exit 1; fi

if gcc -DHAVE_CONFIG_H -I. -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT sb_logger.o -MD -MP -MF ".deps/sb_logger.Tpo" -c -o sb_logger.o sb_logger.c; \

        then mv -f ".deps/sb_logger.Tpo" ".deps/sb_logger.Po"; else rm -f ".deps/sb_logger.Tpo"; exit 1; fi

if gcc -DHAVE_CONFIG_H -I. -I. -I../config  -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I../sysbench  -pthread -g -O2 -MT db_driver.o -MD -MP -MF ".deps/db_driver.Tpo" -c -o db_driver.o db_driver.c; \

        then mv -f ".deps/db_driver.Tpo" ".deps/db_driver.Po"; else rm -f ".deps/db_driver.Tpo"; exit 1; fi

/bin/sh ../libtool --tag=CC --mode=link gcc -pthread -g -O2   -o sysbench     sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/var/lib/mysql -lmysqlclient_r   -lrt -lm

mkdir .libs

gcc -pthread -g -O2 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/var/lib/mysql -lmysqlclient_r -lrt -lm

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench'

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench'

make[1]: Entering directory `/mysql_log/sysbench-0.4.12'

make[1]: Nothing to be done for `all-am'.

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12'

[root@wg2 sysbench-0.4.12]# make install

Making install in doc

make[1]: Entering directory `/mysql_log/sysbench-0.4.12/doc'

Making install in xsl

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[3]: Nothing to be done for `install-exec-am'.

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/doc/xsl'

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/doc'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/doc'

make[3]: Nothing to be done for `install-exec-am'.

test -z "/usr/local/share/doc/sysbench" || mkdir -p -- "/usr/local/share/doc/sysbench"

 /usr/bin/install -c -m 644 'manual.html' '/usr/local/share/doc/sysbench/manual.html'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/doc'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/doc'

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12/doc'

Making install in sysbench

make[1]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench'

Making install in drivers

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

Making install in mysql

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers/mysql'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/drivers'

Making install in tests

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

Making install in cpu

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/cpu'

Making install in fileio

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/fileio'

Making install in memory

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/memory'

Making install in threads

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/threads'

Making install in mutex

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/mutex'

Making install in oltp

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests/oltp'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[4]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench/tests'

Making install in .

make[2]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench'

make[3]: Entering directory `/mysql_log/sysbench-0.4.12/sysbench'

test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"

  /bin/sh ../libtool --mode=install /usr/bin/install -c 'sysbench' '/usr/local/bin/sysbench'

/usr/bin/install -c sysbench /usr/local/bin/sysbench

make[3]: Nothing to be done for `install-data-am'.

make[3]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench'

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench'

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12/sysbench'

make[1]: Entering directory `/mysql_log/sysbench-0.4.12'

make[2]: Entering directory `/mysql_log/sysbench-0.4.12'

make[2]: Nothing to be done for `install-exec-am'.

make[2]: Nothing to be done for `install-data-am'.

make[2]: Leaving directory `/mysql_log/sysbench-0.4.12'

make[1]: Leaving directory `/mysql_log/sysbench-0.4.12'

[root@wg2 sysbench-0.4.12]#

安裝成功,沒有任何錯誤提示

 

2.      sysbench支援的功能引數

 

首先,看看sysbench都支援哪些功能引數:

[root@db-master sysbench]# sysbench --help

Usage:

  sysbench [general-options]... --test= [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 wait after --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

See 'sysbench --test= help' for a list of options for each test.

Sysbench的測試主要包括以下幾個方面:

1、磁碟io效能

2、cpu效能

3、記憶體分配及傳輸速度

4、POSIX執行緒效能

5、排程程式效能

6、資料庫效能(OLTP基準測試).

 

2.1 測試fileio命令幫助:

[root@db-master ~]# sysbench --test=fileio help  

sysbench 0.4.12:  multi-threaded system evaluation benchmark

fileio options:

  --file-num=N                  number of files to create [128]

  --file-block-size=N           block size to use in all IO operations [16384]

  --file-total-size=SIZE        total size of files to create [2G]

  --file-test-mode=STRING       test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}

  --file-io-mode=STRING         file operations mode {sync,async,fastmmap,slowmmap} [sync]

  --file-async-backlog=N        number of asynchronous operatons to queue per thread [128]

  --file-extra-flags=STRING     additional flags to use on opening files {sync,dsync,direct} []

  --file-fsync-freq=N           do fsync() after this number of requests (0 - don't use fsync()) [100]

  --file-fsync-all=[on|off]     do fsync() after each write operation [off]

  --file-fsync-end=[on|off]     do fsync() at the end of test [on]

  --file-fsync-mode=STRING      which method to use for synchronization {fsync, fdatasync} [fsync]

  --file-merged-requests=N      merge at most this number of IO requests if possible (0 - don't merge) [0]

  --file-rw-ratio=N             reads/writes ratio for combined test [1.5]

 

引數詳解:

--file-num=N          代表生成測試檔案的數量,預設為128。

--file-block-size=N      測試時所使用檔案塊的大小,如果想磁碟針對innodb儲存引擎進行測試,可以將其設定為16384,即innodb儲存引擎頁的大小。預設為16384。

--file-total-size=SIZE     建立測試檔案的總大小,預設為2G大小。

--file-test-mode=STRING 檔案測試模式,包含:seqwr(順序寫), seqrewr(順序讀寫), seqrd(順序讀), rndrd(隨機讀), rndwr(隨機寫), rndrw(隨機讀寫)。

--file-io-mode=STRING   檔案操作的模式,sync(同步),async(非同步),fastmmap(快速mmap),slowmmap(慢速mmap),預設為sync同步模式。

--file-async-backlog=N   對應每個執行緒佇列的非同步運算元,預設為128。

--file-extra-flags=STRING 開啟檔案時的選項,這是與API相關的引數。

--file-fsync-freq=N      執行fsync()函式的頻率。fsync主要是同步磁碟檔案,因為可能有系統和磁碟緩衝的關係。 0代表不使用fsync函式。預設值為100。

--file-fsync-all=[on|off]  每執行完一次寫操作,就執行一次fsync。預設為off。

--file-fsync-end=[on|off] 在測試結束時執行fsync函式。預設為on。

--file-fsync-mode=STRING檔案同步函式的選擇,同樣是和API相關的引數,由於多個作業系統對於fdatasync支援不同,因此不建議使用fdatasync。預設為fsync。

--file-merged-requests=N 大多情況下,合併可能的IO的請求數,預設為0。

--file-rw-ratio=N         測試時的讀寫比例,預設時為1.5,即可3:2。

 

2.2 測試cpu命令幫助:

[root@db-master ~]# sysbench --test=cpu help

sysbench 0.4.12:  multi-threaded system evaluation benchmark

cpu options:

  --cpu-max-prime=N      upper limit for primes generator [10000]

 引數詳解:

  --cpu-max-prime=N      用來選項指定最大的素數,具體引數可以根據CPU的效能來設定,預設為10000

 

2.3 測試memory命令幫助:

[root@db-master ~]# sysbench  --test=memory help

sysbench 0.4.12:  multi-threaded system evaluation benchmark

memory options:

  --memory-block-size=SIZE    size of memory block for test [1K]

  --memory-total-size=SIZE    total size of data to transfer [100G]

  --memory-scope=STRING       memory access scope {global,local} [global]

  --memory-hugetlb=[on|off]   allocate memory from HugeTLB pool [off]

  --memory-oper=STRING        type of memory operations {read, write, none} [write]

  --memory-access-mode=STRING memory access mode {seq,rnd} [seq]

 

引數詳解:

  --memory-block-size=SIZE      測試記憶體塊的大小,預設為1K

  --memory-total-size=SIZE       資料傳輸的總大小,預設為100G

  --memory-scope=STRING       記憶體訪問的範圍,包括全域性和本地範圍,預設為global

  --memory-hugetlb=[on|off]     是否從HugeTLB池分配記憶體的開關,預設為off

  --memory-oper=STRING        記憶體操作的型別,包括read, write, none,預設為write

  --memory-access-mode=STRING 記憶體訪問模式,包括seq,rnd兩種模式,預設為seq

 

 

 

2.4 測試threads命令幫助: 

[root@db-master ~]# sysbench  --test=threads help

sysbench 0.4.12:  multi-threaded system evaluation benchmark

threads options:

  --thread-yields=N      number of yields to do per request [1000]

  --thread-locks=N       number of locks per thread [8]

引數詳解: 

  --thread-yields=N      指定每個請求的壓力,預設為1000

  --thread-locks=N       指定每個執行緒的鎖數量,預設為8

 

  

2.5 測試mutex命令幫助:

[root@db-master ~]# sysbench  --test=mutex help 

sysbench 0.4.12:  multi-threaded system evaluation benchmark

mutex options:

  --mutex-num=N        total size of mutex array [4096]

  --mutex-locks=N      number of mutex locks to do per thread [50000]

  --mutex-loops=N      number of empty loops to do inside mutex lock [10000]

引數詳解:

  --mutex-num=N    陣列互斥的總大小。預設是4096

  --mutex-locks=N    每個執行緒互斥鎖的數量。預設是50000

  --mutex-loops=N    內部互斥鎖的空迴圈數量。預設是10000

2.6 測試oltp命令幫助:  

 

[root@db-master ~]# sysbench --test=oltp help 

sysbench 0.4.12:  multi-threaded system evaluation benchmark

oltp options:

  --oltp-test-mode=STRING         test type to use {simple,complex,nontrx,sp} [complex]

  --oltp-reconnect-mode=STRING    reconnect mode {session,transaction,query,random} [session]

  --oltp-sp-name=STRING           name of store procedure to call in SP test mode []

  --oltp-read-only=[on|off]       generate only 'read' queries (do not modify database) [off]

  --oltp-skip-trx=[on|off]        skip BEGIN/COMMIT statements [off]

  --oltp-range-size=N             range size for range queries [100]

  --oltp-point-selects=N          number of point selects [10]

  --oltp-simple-ranges=N          number of simple ranges [1]

  --oltp-sum-ranges=N             number of sum ranges [1]

  --oltp-order-ranges=N           number of ordered ranges [1]

  --oltp-distinct-ranges=N        number of distinct ranges [1]

  --oltp-index-updates=N          number of index update [1]

  --oltp-non-index-updates=N      number of non-index updates [1]

  --oltp-nontrx-mode=STRING       mode for non-transactional test {select, update_key, update_nokey, insert, delete} [select]

  --oltp-auto-inc=[on|off]        whether AUTO_INCREMENT (or equivalent) should be used on id column [on]

  --oltp-connect-delay=N          time in microseconds to sleep after connection to database [10000]

  --oltp-user-delay-min=N         minimum time in microseconds to sleep after each request [0]

  --oltp-user-delay-max=N         maximum time in microseconds to sleep after each request [0]

  --oltp-table-name=STRING        name of test table [sbtest]

  --oltp-table-size=N             number of records in test table [10000]

  --oltp-dist-type=STRING         random numbers distribution {uniform,gaussian,special} [special]

  --oltp-dist-iter=N              number of iterations used for numbers generation [12]

  --oltp-dist-pct=N               percentage of values to be treated as 'special' (for special distribution) [1]

  --oltp-dist-res=N               percentage of 'special' values to use (for special distribution) [75]

General database options:

  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers)

  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]

Compiled-in database drivers:

  mysql - MySQL driver

  pgsql - PostgreSQL driver

mysql options:

  --mysql-host=[LIST,...]       MySQL server host [localhost]

  --mysql-port=N                MySQL server port [3306]

  --mysql-socket=STRING         MySQL socket

  --mysql-user=STRING           MySQL user [sbtest]

  --mysql-password=STRING       MySQL password []

  --mysql-db=STRING             MySQL database name [sbtest]

  --mysql-table-engine=STRING   storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb]

  --mysql-engine-trx=STRING     whether storage engine used is transactional or not {yes,no,auto} [auto]

  --mysql-ssl=[on|off]          use SSL connections, if available in the client library [off]

  --myisam-max-rows=N           max-rows parameter for MyISAM tables [1000000]

  --mysql-create-options=STRING additional options passed to CREATE TABLE []

pgsql options:

  --pgsql-host=STRING     PostgreSQL server host [localhost]

  --pgsql-port=N          PostgreSQL server port [5432]

  --pgsql-user=STRING     PostgreSQL user [sbtest]

  --pgsql-password=STRING PostgreSQL password []

  --pgsql-db=STRING       PostgreSQL database name [sbtest]

引數詳解:

  --oltp-test-mode=STRING    執行模式{simple,complex(advanced transactional),nontrx(non-transactional),sp}。預設是complex

  --oltp-reconnect-mode=STRING 重新連線模式{session(不使用重新連線。每個執行緒斷開只在測試結束),transaction(在每次事務結束後重新連線),query(在每個SQL語句執行完重新連線),random(對於每個事務隨機選擇以上重新連線模式)}。預設是session

  --oltp-sp-name=STRING   儲存過程的名稱。預設為空

  --oltp-read-only=[on|off]  只讀模式。Update,delete,insert語句不可執行。預設是off

  --oltp-skip-trx=[on|off]   省略begin/commit語句。預設是off

  --oltp-range-size=N      查詢範圍。預設是100

  --oltp-point-selects=N          number of point selects [10]

  --oltp-simple-ranges=N          number of simple ranges [1]

  --oltp-sum-ranges=N             number of sum ranges [1]

  --oltp-order-ranges=N           number of ordered ranges [1]

  --oltp-distinct-ranges=N        number of distinct ranges [1]

  --oltp-index-updates=N          number of index update [1]

  --oltp-non-index-updates=N      number of non-index updates [1]

  --oltp-nontrx-mode=STRING   查詢型別對於非事務執行模式{select, update_key, update_nokey, insert, delete} [select]

  --oltp-auto-inc=[on|off]      AUTO_INCREMENT是否開啟。預設是on

  --oltp-connect-delay=N     在多少微秒後連線資料庫。預設是10000

  --oltp-user-delay-min=N    每個請求最短等待時間。單位是ms。預設是0

  --oltp-user-delay-max=N    每個請求最長等待時間。單位是ms。預設是0

  --oltp-table-name=STRING  測試時使用到的表名。預設是sbtest

  --oltp-table-size=N         測試表的記錄數。預設是10000

  --oltp-dist-type=STRING    分佈的隨機數{uniform(均勻分佈),Gaussian(高斯分佈),special(空間分佈)}。預設是special

  --oltp-dist-iter=N    產生數的迭代次數。預設是12

  --oltp-dist-pct=N    值的百分比被視為'special' (for special distribution)。預設是1

  --oltp-dist-res=N    ‘special’的百分比值。預設是75

 

 

3.      總結:

以上就是sysbench工具的安裝配置及相關選項引數的介紹,可以根據自己的需要新增對應的引數進行壓力測試即可。在下一篇文件中將會對上面的幾種模式進行相應的測試。

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29893219/viewspace-1851553/,如需轉載,請註明出處,否則將追究法律責任。

相關文章