当前位置: 首页 > Linux

sysbench基准测试

时间:2023-04-06 23:14:00 Linux

sysbench测试基本信息192.168.1.58和192.168.1.59内核参数文件内容一致主机CPU核心数内存大小内核版本192.168.1.584核心8G2.6.32192.168.1.584核心8G2.6.32安装sysbench官方安装脚本方法curl-shttps://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh|sudobashyum安装方法yuminstallepel-release&&sudoyum-yinstallsysbenchexportLD_LIBRARY_PATH=/usr/local/mysql/lib/1CPUbenchmarkreport使用如下参数--num-threads线程数,默认值为1--max-requests最大请求数,默认值为10000--cpu-max-prime最大质数,使用该参数后,将使用64位int类型进行性能测试计算--percentilevalue百分比值,默认为95,即丢弃5%的长请求,在剩下的95%中取最大值#指定线程数和最大请求??数,测试CPUsysbench--num-threads=16--max-requests=20000--debug=on--test=cpu--cpu-max-prime=50000运行主机线程最大请求数计算最大素数最小总时间ResponseTimeMaxResponseTime平均响应时间95%AverageResponseTimeforStatements192.168.1.5816200005000010.0332s12.13ms48.45ms111.34ms78.60ms192.168.1.5916200005000010.0567s23.74ms77.91ms175.95ms9DiskBenchmarkReportsSIOBenchmark25.95ms9Thetestneedstogothroughthreestagesofprepare,runandcleanup.prepare是准备阶段,生产需要的测试文件,run是实际测试阶段,cleanup是清理测试生成的文件。使用4个文件和2GB的总大小执行fileio测试:sysbenchfileio\--file-num=4\--file-total-size=2G\preparesysbenchfileio\--time=180\--events=100000000\--threads=1\--file-num=4\--file-total-size=2G\--file-io-mode=sync\--file-test-mode=rndrd\--file-block-size=16384\runsysbenchfileio\--file-num=16\--file-total-size=2G\cleanupprepare阶段主机名准备时间率192.168.1.5810.24s200.02MiB/s192.168.1.5939.61s51.70MiB/s测试阶段主机名测试模式最大随机请求数磁盘IOPS磁盘每秒速率192.168.1.58rndrd100000000257233.754019.28192.168.1.59rndrd100000000177808.022778.253OLTP基准查看helpsysbench--test=oltp--helpmysql主要测试以下参数trx=STRING指定要测试的不同存储引擎。--oltp-test-mode=STRING测试类型:simple(简单select测试)、complex(事务测试)、nontrx(非事务测试)、sp(存储过程);defaultcomplex--oltp-sp-name=STRING指定语句测试的存储过程--oltp-table-size=N指定表的记录大小,默认[10000]--oltp-num-tables=N指定个数oftesttables,default[1]createthetestdatabaseeitesttransactionfirstTest,测试12个线程执行10000个请求,10张表,每张表大小100WPreparesysbench--num-threads=12--max-requests=100000\--test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua\--mysql-user=root--mysql-password=123456\--oltp-test-mode=complex--mysql-db=eitest--db-driver=mysql\--oltp-table-size=1000000--oltp-num-tables=10准备测试sysbench--num-threads=12--max-requests=100000\--test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua\--mysql-user=root--mysql-password=123456\--oltp-test-mode=complex--mysql-db=eitest--db-driver=mysql\--oltp-table-size=1000000--oltp-num-tables=10运行cleansysbench--num-threads=12--max-requests=100000\--test=/usr/share/sysbench/tests/include/oltp_legacy/oltp.lua\--mysql-用户=root--mysql-password=123456\--oltp-test-mode=complex--mysql-db=eitest--db-driver=mysql\--oltp-table-size=1000000--oltp-num-tables=10cleanupTransactionspersecondTPS每秒读写请求数RQHostnameCPUcorenumberTotalmemorytimeTPSRQ95%oftherequestcosts192.168.1.584cores8G10.0099s850.0016999.9823.95192.168.1.592cores8G10.0100s775.50155609.9592cores.20