使用sysbench进行MySQL性能基准测试

Posted by hualeizhang on 2024-02-02
Estimated Reading Time 1 Minutes
Words 229 In Total
Viewed Times

使用sysbench进行MySQL性能基准测试

安装sysbench

1
sudo yum install sysbench 

测试数据准备

创建数据库

1
create database sbtest;

创建数据

1
2
# prepare 命令
sysbench oltp_common.lua --time=300 --mysql-host=xx.xx.xx.xx --mysql-port=3306 --mysql-user=root --mysql-password=1111 --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=32 --events=999999999 prepare

prepare.png

开始测试

1
2
# run 命令
sysbench oltp_read_write.lua --time=300 --mysql-host=xx.xx.xx.xx --mysql-port=3306 --mysql-user=root --mysql-password=1111 --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=32 --events=999999999 --report-interval=10 run

32线程测试

test32thread.png

64线程测试

test64thread.png

128线程测试

test128thread.png

128线程测试结果汇总

summary128.png

清理测试数据

1
2
# cleanup命令
sysbench oltp_read_write.lua --time=300 --mysql-host=xx.xx.xx.xx --mysql-port=3306 --mysql-user=root --mysql-password=1111 --mysql-db=sbtest --table-size=1000000 --tables=10 --threads=32 --events=999999999 --report-interval=10 cleanup

cleanup.png

总结

随着线程数从32—>64—>128,TPS和QPS呈上升趋势,延迟也越来越高,说明随着并发量的增加,性能逐渐出现瓶颈。


如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !