• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

利用Sysbench0.5对MySQL进展压测_mysql

mysql 搞代码 7年前 (2018-06-07) 314次浏览 已收录 0个评论

利用Sysbench0.5对mysql进行压测

1 下载sysbench-0.5.tar.gz

下载地址   http://download.csdn.net/download/rcbblgy/7578433

2 执行如下命令

tar xzvf sysbench-0.5.tar.gz
cd sysbench-0.5
chmod +x autogen.sh
./autogen.sh
./configure --with-mysql --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make
make install

3 查询sysbench是否正确安装  sysbench -v

4 常用的参数列表

     –mysql-host=test.mysql.rds.aliyuncs.com           #数据库host

     –mysql-port=3306                                              #数据库端口
     –mysql-user=your_username                             #数据库用户名
     –mysql-password=your_password                      #数据库密码
     –mysql-db=your_db_for_test                              #数据库名
     –oltp-tables-count=10                        #模拟的表的个数,规格越高该值越大
     –oltp-table-size=6000000                  #模拟的每张表的行数,规格越高该值越大
     –num-threads=50                              #模拟的并发数量,规格越高该值越大
     –max-requests=100000000               #最大请求次数
     –max-time=20                           #最大测试时间(与–max-requests只要有一个超过,则退出)
     –report-interval=1                     #每1秒打印一次当前的QPS等值
     –test=/tmp/sysbench-0.5/sysbench/tests/db/oltp.lua    #选用的测试脚本(lua),此脚本可以从sysbench-0.5源代码文件目录下找
     [prepare | run | cleanup]           #prepare准备数据,run执行测试,cleanup清理数据

5 准备数据

[root@iZ254t8pd33Z ~]# sysbench –mysql-host=yongche1.mysql.rds.aliyuncs.com –mysql-port=3306 –mysql-user=jiangjianjian  –mysql-password=pansino –mysql-db=yongche1 –oltp-tables-count=10 –oltp-table-size=6000000 –num-threads=50 –max-requests=100000000 –report-interval=1 –test=/root/sysbench-0.5/sysbench/tests/db/oltp.lua prepare

6  进行测试及结果分析

oltp进行压测

[root@iZ254t8pd33Z ~]# sysbench –mysql-host=yongche1.mysql.rds.aliyuncs.com –mysql-port=3306 –mysql-user=jiangjianjian  –mysql-password=pansino –mysql-db=yongche1 –oltp-tables-count=10 –oltp-table-size=6000000 –num-threads=50 –max-requests=100000000 –report-interval=1  –max-time=20  –test=/root/sysbench-0.5/sysbench/tests/db/oltp.lua run
利用Sysbench0.5对MySQL进展压测_mysql
利用Sysbench0.5对MySQL进展压测_mysql
分析压测结果   TPS是平均每秒钟事务提交次数,QPS表示每秒查询次数(包括read和write)
oltp 读写比大概5300:1500
利用Sysbench0.5对MySQL进展压测_mysql

纯insert情况  
[root@iZ254t8pd33Z ~]# sysbench –mysql-host=yongche1.mysql.rds.aliyuncs.com –mysql-port=3306 –mysql-user=jiangjianjian  –mysql-password=pansino –mysql-db=yongche1 –oltp-tables-count=10 –oltp-table-size=6000000 –num-threads=50 –max-requests=100000000 –report-interval=1  –max-time=20   –test=/root/sysbench-0.5/sysbench/tests/db/insert.lua run
利用Sysbench0.5对MySQL进展压测_mysql
利用Sysbench0.5对MySQL进展压测_mysql
利用Sysbench0.5对MySQL进展压测_mysql

结果分析:每秒写入大概是4000条


内存测试 
sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw prepare
sysbench –test=memory –memory-block-size=8192 –memory-total-size=4G run
利用Sysbench0.5对MySQL进展压测_mysql

传输4G内容,每个block 8k,速度大概每秒6093M


磁盘IO测试
sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw prepare
sysbench –test=fileio –num-threads=16 –file-total-size=3G –file-test-mode=rndrw run
利用Sysbench0.5对MySQL进展压测_mysql
指定了最大创建16个线程,创建的文档总大小为3G,文档读写模式为随机读,磁盘随机读写速度大概为38M/s

CPU测试
sysbench –test=cpu –num-threads=32 –cpu-max-prime=90000 run
利用Sysbench0.5对MySQL进展压测_mysql

32个线程,寻找90000以内的最大素数花了80s

PS   
硬件条件    阿里云RDS 
                 内存大小:     24000M 
                最大IOPS:   12000
                数据库类型:MySQL5.6
                最大连接数:2000
             




欢迎大家阅读《利用Sysbench0.5对MySQL进展压测_mysql》,跪求各位点评,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:利用Sysbench0.5对MySQL进展压测_mysql

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址