sysbench-05使用手册

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

sysbench介绍SysBench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况。它主要包括以下几种方式的测试:1、cpu性能2、磁盘io性能3、调度程序性能4、内存分配及传输速度5、POSIX线程性能6、数据库性能(OLTP基准测试)目前sysbench主要支持MySQL,pgsql,Oracle这3种数据库。sysbench安装默认支持MySQL,如果需要测试Oracle/PostgreSQL,则在configure时需要加上–with-oracle或者–with-pgsql参数,sysbench默认安装在:/usr/local/bin/sysbenchYum源也可以直接安装:yuminstallsysbench基于Debain的操作系统,可以直接安装:sudoapt-getinstallsysbench也可以下载源码,然后自己编译安装。tarxzvfsysbench-0.5.tar.gzcdsysbench-0.5chmod+xautogen.sh./autogen.sh./configure--with-mysql--with-mysql-includes=/usr/local/mysql/include--with-mysql-libs=/usr/local/mysql/libmake&&makeinstallshelltar-zxvfsysbench-0.5.tar.gz-C/db/tool/shellcd/db/tool/sysbench-0.5shellchmod+xautogen.shshell./autogen.shautomake1.10.x(aclocal)wasn'tfound,exitingshellyuminstallautomakeshell./autogen.shlibtoolize1.4+wasn'tfound,exitingshellyuminstalllibtoolshell./autogen.sh./autogen.sh./autogen.sh:running`aclocal-Im4'./autogen.sh:running`libtoolize--copy--force'libtoolize:puttingauxiliaryfilesinAC_CONFIG_AUX_DIR,`config'.libtoolize:copyingfile`config/ltmain.sh'libtoolize:puttingmacrosinAC_CONFIG_MACRO_DIR,`m4'.libtoolize:copyingfile`m4/libtool.m4'libtoolize:copyingfile`m4/ltoptions.m4'libtoolize:copyingfile`m4/ltsugar.m4'libtoolize:copyingfile`m4/ltversion.m4'libtoolize:copyingfile`m4/lt~obsolete.m4'./autogen.sh:running`autoheader'./autogen.sh:running`automake-c--foreign--add-missing'configure.ac:23:installing`config/compile'configure.ac:11:installing`config/config.guess'configure.ac:11:installing`config/config.sub'configure.ac:16:installing`config/install-sh'configure.ac:16:installing`config/missing'sysbench/Makefile.am:installing`config/depcomp'./autogen.sh:running`autoconf'Libtoolizedwith:libtoolize(GNUlibtool)2.2.6bAutomadewith:automake(GNUautomake)1.11.1Configuredwith:autoconf(GNUAutoconf)2.63shell./configure--prefix=/db/sysbench--with-mysql-includes=/db/mysql/include--with-mysql-libs=/db/mysql/libshellmake&&makeinstall测试安装shellcp/db/sysbench/bin/sysbench/usr/local/bin/shellsysbench--helpsysbench:errorwhileloadingsharedlibraries:libmysqlclient.so.18:cannotopensharedobjectfile:Nosuchfileordirectory问题原因:sysbench无法找到mysql的库文件,可能是环境变量LD_LIBRARY_PATH没有设置,设置后即可解决该问题:添加exportLD_LIBRARY_PATH=/db/mysql/lib即可查询sysbench是否正确安装sysbench–vCPU测试sysbenchCPU测试使用64位整数,测试计算素数直到某个最大值所需要的时间shellsysbench--test=cpu--cpu-max-prime=2000runsysbench0.5:multi-threadedsystemevaluationbenchmarkRunningthetestwithfollowingoptions:Numberofthreads:1Randomnumbergeneratorseedis0andwillbeignoredPrimernumberslimit:2000Threadsstarted!Testexecutionsummary:totaltime:2.2452stotalnumberofevents:10000totaltimetakenbyeventexecution:2.2347sper-requeststatistics:min:0.20msavg:0.22msmax:3.35msapprox.95percentile:0.27msThreadsfairness:events(avg/stddev):10000.0000/0.00executiontime(avg/stddev):2.2347/0.00补充:查看CPU信息方法查看物理cpu个数grepphysicalid/proc/cpuinfo|sort-u|wc-l查看核心数量grepcoreid/proc/cpuinfo|sort-u|wc-l查看线程数量grepprocessor/proc/cpuinfo|sort-u|wc-l在sysbench的测试中,--num-threads取值为线程数量即可线程(thread)测试测试线程调度器的性能。对于高负载情况下测试线程调度器的行为非常有用shellsysbench--test=threads--num-threads=64--thread-yields=100--thread-locks=2runsysbench0.5:multi-threadedsystemevaluationbenchmarkRunningthetestwithfollowingoptions:Numberofthreads:64Randomnumbergeneratorseedis0andwillbeignoredThreadsstarted!Testexecutionsummary:totaltime:1.9581stotalnumberofevents:10000totaltimetakenbyeventexecution:124.8938sper-requeststatistics:min:0.05msavg:12.49msmax:151.15msapprox.95percentile:50.83msThreadsfairness:events(avg/stddev):156.2500/14.48executiontime(avg/stddev):1.9515/0.00文件IO性能测试生成需要的测试文件,文件总大小5G,16个并发线程。执行完后会在当前目录下生成一堆小文件shellsysbench--test=fileio--num-threads=16--file-total-size=5Gprepare执行测试,指定随机读写模式指定读写模式:seqwr顺序写入seqrewr顺序重写seqrd顺序读取rndrd随机读取rndwr随机写入rndrw混合随机读/写shellsysbench--test=fileio--num-threads=16--init-rng=on--file-total-size=5G--file-test-mode=rndrwrunsysbench0.5:multi-threadedsystemevaluationbenchmarkRunningthetestwithfollowingoptions:Numberofthreads:16Randomnumbergeneratorseedis0andwillbeignoredThreadsstarted!Operationsperformed:5999reads,4001writes,12800Other=22800TotalRead93.734MbWritten62.516MbTotaltransferred156.25Mb(9.2561Mb/sec)##吞吐量592.39Requests/secexecutedTestexecutionsummary:totaltime:16.8808stotalnumberofevents:10000totaltimetakenbyeventexecution:176.1816sper-requeststatistics:min:0.01msavg:17.62msmax:416.73msapprox.95percentile:104.82msThreadsfairness:events(avg/stddev):625.0000/62.39executiontime(avg/stddev):11.0114/0.67清除测试文件shellsysbench--test=fileio--num-threads=16--file-total-size=5Gcleanup互斥锁(Mutex)测试测试互斥锁的性能,方式是模拟所有线程在同一时刻并发运行,并都短暂请求互斥锁。shellsysbench--test=mutex--num-threads=16--mutex-num=1024--mutex-locks=10000--mutex-loops=5000runsysbench0.5:multi-threadedsystemevaluationbenchmarkRunningthetestwithfollowingoptions:Numberofthreads:16Randomnumbergeneratorseedis0andwillbeignoredThreadsstarted!Testexecutionsummary:totaltime:0.0135stotalnumberofevents:16totaltimetakenbyeventexecution:0.0411sper-requeststatistics:min:0.70msavg:2.57msmax:9.19msapprox.95percentile:9.16msTh

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功