多线程压测_详解sysbench生产环境数据库压测并输出数据库压测报告

概述

sysbench是基于LuaJIT的可以脚本化多线程基准。 它是一个模块化的、跨平台、多线程基准测试工具,最常用于数据库基准测试,但也可以用于创建不涉及数据库服务器的任意复杂工作负载。

前面讲了那么多sysbench的内容,这里就要开始真枪实弹上生产压测了,这里以UAT环境做一个演示。


一、压测环境

生产环境:

MySQL服务器IP地址:xx.xx.xx.xx

操作系统:CentOS Linux release 7.3.1611 (Core)

CPU:4核

内存:8G

硬盘:普通SAS硬盘

基线测试工具:sysbench


二、sysbench生产环境压测(怕头条又屏蔽我代码,我还是不放到代码块了)

--准备20张表,每张表500万数据

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=5000000 --rand-init=on prepare

--innodb_buffer_pool_size取6G,innodb_log_buffer_size=64M,innodb_log_file_size=256M,max_allowed_packet=10G;

--测试并发数分别取2、100、200、500、800时对应的TPS、QPS、响应时间(avg)值

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=2

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 2_threads_64M_buffer_256M_logsize.log

860a4f266231ca22f9375411ae15649d.png

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=100

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 100_threads_64M_buffer_256M_logsize.log

bf6495ecc00fc08b3e652a9d787b4656.png

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=200

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 200_threads_64M_buffer_256M_logsize.log

2d679a3c4aca025c001ddf145896bd96.png

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=300

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 300_threads_64M_buffer_256M_logsize.log

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=500

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 500_threads_64M_buffer_256M_logsize.log

95a7cba6fe96b775d3ba8fb7f700f66e.png

sysbench --mysql-host=172.26.151.74 --mysql-port=3306 --mysql-user=tpcc --mysql-password=tpcc@1234

--test=/usr/local/sysbench/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=20 --oltp-table-size=1000000 --num-threads=800

--oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> 800_threads_64M_buffer_256M_logsize.log

473c2f2f462c6f9be85a2b8dab90db7a.png

发现压测到800的时候sysbench会报错:FATAL: `thread_run' function failed: ...sbench/share/sysbench/tests/include/oltp_legacy/oltp.lua:43: Failed to connect to the database FATAL: unable to connect to MySQL server on host '172.26.151.74', port 3306, aborting...

FATAL: error 2026: SSL connection error: unable to use random device

而mysql服务器会报错: [Note] Bad handshake


以上就是生产环境压测的过程,后面会介绍怎么基于这些数据去做数据统计。觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~

c7755ef9db7994c01b33297b27933d25.gif
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值