mysql sysben0.5的安装和测试步骤
发布时间:2022-01-18 13:22:51 所属栏目:MySql教程 来源:互联网
导读:这篇文章主要介绍mysql sysben0.5的安装和测试步骤,在日常操作中,相信很多人在mysql sysben0.5的安装和测试步骤问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答mysql sysben0.5的安装和测试步骤的疑惑有所帮助!接下来,请
这篇文章主要介绍“mysql sysben0.5的安装和测试步骤”,在日常操作中,相信很多人在mysql sysben0.5的安装和测试步骤问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”mysql sysben0.5的安装和测试步骤”的疑惑有所帮助!接下来,请跟着小编一起来学习吧! 安装sysbench OS readhat 6.4 mysql版本5.7 mysql安装目录 下载安装包 https://github.com/akopytov/sysbench shell> wget https://github.com/akopytov/sysbench/archive/1.0.zip -O "sysbench-1.0.zip" 2. 安装依赖包 # yum -y install make automake libtool pkgconfig libaio-devel vim-common 3、上传到linux系统中(/usr/local/),并且解压,进入/usr/local/执行: p unzip sysbench-0.5.zip -d /usr/local 4、创建sysbench安装目录文件夹: 5、进入/usr/local/sysbench-master/执行:./autogen.sh # cd /usr/local/sysbench-0.5 # ./autogen.sh 6. #./configure --prefix=/usr/local/sysbench-0.5 --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib/; 7. # make 8. # make install 9.查看版本 [root@msyqlzhu sysbench-0.5]# /usr/local/sysbench-0.5/bin/sysbench version sysbench 0.5 如果出现:(sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory)报错, 则在(vim /etc/profile 中加入:export LD_LIBRARY_PATH=/usr/local/mysql/lib/) 常用参数: #-test=tests/db/oltp.lua 表示调用 tests/db/oltp.lua 脚本进行 oltp 模式测试 #--oltp_tables_count=10 表示会生成 10 个测试表 #--oltp-table-size=100000 表示每个测试表填充数据量为 100000 #--rand-init=on 表示每个测试表都是用随机数据来填充的 #-num-threads=8 表示发起 8个并发连接 #--oltp-read-表示不要进行只读测试,也就是会采用读写混合模式测试 #--report-interval=10 表示每10秒输出一次测试进度报告 #--rand-type=uniform 表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托) #--max-time=120 表示最大执行时长为 120秒 #--max-requests=0 表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长 #--percentile=99 表示设定采样比例,默认是 95%,即丢弃1%的长请求,在剩余的99%里取最大值 测试文件IO 测试cpu的CPU测试使用64位整数,测试计算素数直到某个最大值所需要的时间。 # /usr/local/sysbench-0.5/bin/sysbench --test=cpu --cpu-max-prime=20000 run General statistics: total time: 26.8631s total number of events: 10000 total time taken by event execution: 26.8434s response time: min: 2.24ms avg: 2.68ms max: 7.49ms approx. 95 percentile: 3.20ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 26.8434/0.00 1.测试线程 [root@msyqlzhu t]# /usr/local/sysbench-0.5/bin/sysbench --test=threads --num-threads=64 run sysbench 0.5: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 64 Random number generator seed is 0 and will be ignored Initializing worker threads... Threads started! General statistics: total time: 5.2132s total number of events: 10000 total time taken by event execution: 332.6492s response time: min: 0.23ms avg: 33.26ms max: 282.98ms approx. 95 percentile: 87.66ms Threads fairness: events (avg/stddev): 156.2500/5.53 execution time (avg/stddev): 5.1976/0.01 2.互斥锁测试互斥锁(mutex) /usr/local/sysbench-0.5/bin/sysbench --test=mutex --num-threads=16 --mutex-num=2048 --mutex-locks=1000000 --mutex-loops=5000 run sysbench 0.5: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 16 Random number generator seed is 0 and will be ignored Initializing worker threads... Threads started! General statistics: total time: 2.5536s total number of events: 16 total time taken by event execution: 39.6446s response time: min: 2348.59ms avg: 2477.79ms max: 2553.24ms approx. 95 percentile: 2549.79ms Threads fairness: events (avg/stddev): 1.0000/0.00 execution time (avg/stddev): 2.4778/0.07 3.内存测试 [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=memory --memory-block-size=8K --memory-total-size=1G --num-threads=16 run 4. 文件IO基准测试 共1G [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-total-size=1G prepare 1073741824 bytes written in 8.15 seconds (125.60 MB/sec). 测试文件IO 4个文件共4G [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-num=4 --file-total-size=4G prepare 4261412864 bytes written in 6.52 seconds (623.68 MB/sec). 测试文件IO 4个文件共4G.块大小为16K [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-num=4 --file-block-size=16384 --file-total-size=4G prepare 这个命令会在当前工作目录下创建测试文件,后续的运行(run)阶段将通过读写这些文件进行测试。 第二步就是运行(run)阶段,针对不同的IO 类型有不同的测试选项: seqwr 顺序写入 seqrewr 顺序重写 seqrd 顺序读取 rndrd 随机读取 rndwr 随机写入 rndrw 混合随机读/写 下面的命令运行文件I/O混合随机读/写基准测试: 混合随机读/写 /usr/local/sysbench-0.5/bin/sysbench --test=fileio --file-total-size=4G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run 清除测试的文件 /usr/local/sysbench-0.5/bin/sysbench --test=fileio --fil-total-size=30G cleanup 测试oltp 1.找到select.lua脚本路径 [root@msyqlzhu t]# find / -name oltp.lua /usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua 2.创建测试的时候默认用sbtest库 > create database sbtest; 3.prepare生成数据和表 使用的参数 --oltp-table-size 生成的表的记录数 --oltp-tables-count生成的表的个数 # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock prepare 4.run运行 也可使用parallel_prepare.lua脚本并行准备测试数据, 运行时使用的参数 --oltp-dist-pct 热点数据的比例 --oltp-dist-res 热点数据访问频率 --num-threads 线程数 --max-time=3000 执行时间 --report-interval 打印报告的时间间隔 # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --num-threads=20 --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=100 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --max-time=3000 --max-requests=0 --report-interval=3 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock run 生成的报告,tps:约为495,响应时间response time约为380毫秒,qps约为6千多 [ 141s] threads: 100, tps: 481.38, reads: 6728.28, writes: 2001.18, response time: 369.82ms (95%), errors: 0.33, reconnects: 0.00 [ 144s] threads: 100, tps: 495.94, reads: 6958.09, writes: 1970.41, response time: 339.89ms (95%), errors: 0.00, reconnects: 0.00 [ 147s] threads: 100, tps: 513.72, reads: 7193.10, writes: 2076.22, response time: 326.33ms (95%), errors: 0.33, reconnects: 0.00 [ 150s] threads: 100, tps: 494.33, reads: 6921.66, writes: 1971.33, response time: 333.44ms (95%), errors: 0.33, reconnects: 0.00 [ 153s] threads: 100, tps: 441.32, reads: 6032.87, writes: 1685.30, response time: 396.06ms (95%), errors: 0.00, reconnects: 0.00 [ 156s] threads: 100, tps: 502.62, reads: 7007.69, writes: 2000.82, response time: 398.92ms (95%), errors: 0.00, reconnects: 0.00 [ 159s] threads: 100, tps: 428.68, reads: 6192.48, writes: 1805.71, response time: 365.53ms (95%), errors: 0.00, reconnects: 0.00 [ 162s] threads: 100, tps: 438.70, reads: 6140.14, writes: 1777.47, response time: 586.58ms (95%), errors: 0.33, reconnects: 0.00 [ 165s] threads: 100, tps: 495.63, reads: 6928.11, writes: 1951.51, response time: 380.04ms (95%), errors: 0.00, reconnects: 0.00 5.clearnup # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup 测试select 1.prepare生成数据 # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --oltp-table-size=10000000 --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock prepare 2.run运行 运行时使用的参数 --oltp-dist-pct 热点数据的比例 --oltp-dist-res 热点数据访问频率 --num-threads 线程数 --max-time=3000 执行时间 --report-interval 打印报告的时间间隔 打印的报告种的reads表示qps,response time表示响应时间 # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --num-threads=20 --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=10 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --max-time=3000 --max-requests=0 --report-interval=3 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock run [ 84s] threads: 100, tps: 0.00, reads: 22529.11, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00 [ 87s] threads: 100, tps: 0.00, reads: 22455.45, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00 [ 90s] threads: 100, tps: 0.00, reads: 22569.36, writes: 0.00, response time: 0.13ms (95%), errors: 0.00, reconnects: 0.00 [ 93s] threads: 100, tps: 0.00, reads: 21957.72, writes: 0.00, response time: 0.15ms (95%), errors: 0.00, reconnects: 0.00 [ 96s] threads: 100, tps: 0.00, reads: 21588.06, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects: 0.00 cleanup # /usr/local/sysbench-0.5/bin/sysbench --test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua --oltp-dist-pct=1 --oltp-dist-res=75 --oltp-table-size=100000 --num-threads=10 --mysql-db=sbtest --mysql-user=root --oltp-tables-count=10 --mysql-password=ORACLE --mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup 常用参数: Run的时候常用的参数 –oltp-tables-count –oltp-read-only 仅执行SELECT测试 on | off,默认为off –oltp-dist-type 随机数分布状态。uniform(均匀分布)、gauss(高斯分布)、special(特殊分布) –oltp-dist-pct 特殊分布的百分比值 –oltp-dist-res 特殊分布的百分比 –oltp-point-selects 单个事务中指定的selec查询个数 –oltp-range-size 范围查询的范围大小,该值应比oltp-table-size小 –oltp-simple-ranges 单个事务中指定的简单范围查询个数 –oltp-sum-ranges 单个事务中指定的SUM范围查询个数 –oltp-order-ranges 单个事务中指定的ORDER范围查询个数 –oltp-distinct-ranges 单个事务中指定的DISTINCT范围查询个数 –oltp-index-updates 单个事务中指定的使用索引更新的个数 –oltp-non-index-updates 单个事务中指定的不使用索引更新的个数 到此,关于“mysql sysben0.5的安装和测试步骤”的学习就结束了,希望能够解决大家的疑惑。 (编辑:92站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |