sysbench是基于LuaJIT的可编写脚本的多线程基准测试工具。它最常用于数据库基准测试,但也可以用于创建不涉及数据库服务器的任意复杂的工作负载。 参考官方文档:https://github.com/akopytov/sysbench
RHEL / CentOS:
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash sudo yum -y install sysbench [root@bogon ~]# sysbench --version sysbench 1.0.18TPS,QPS相关概念
QPS:Queries Per Second 查询量/秒,是一台服务器每秒能够相应的查询次数,是对一个特定的查询服务器在规定时间内所处理查询量多少的衡量标准
TPS : Transactions Per Second 是事务数/秒,是一台数据库服务器在单位时间内处理的事务的个数。
OLTP测试: 准备阶段: sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size=10000 --mysql-table-engine=innodb --oltp-tables-count=10 --mysql-user=sb_test --mysql-password=sb_test --mysql-port=3306 --mysql-host=10.xx.xx.xxx --mysql-db=sb_test --max-requests=0 --time=10 --report-interval=1 --threads=10 --oltp-point-selects=1 --oltp-simple-ranges=0 --oltp_sum_ranges=0 --oltp_order_ranges=0 --oltp_distinct_ranges=0 --oltp-read-only=on prepare 测试阶段: 命令如下: sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size=10000 --mysql-table-engine=innodb --oltp-tables-count=10 --mysql-user=sb_test --mysql-password=sb_test --mysql-port=3306 --mysql-host=10.xx.xx.xxx --mysql-db=sb_test --max-requests=0 --time=10 --report-interval=1 --threads=10 --oltp-point-selects=1 --oltp-simple-ranges=0 --oltp_sum_ranges=0 --oltp_order_ranges=0 --oltp_distinct_ranges=0 --oltp-read-only=on run 清理阶段: sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size=10000 --mysql-table-engine=innodb --oltp-tables-count=10 --mysql-user=sb_test --mysql-password=sb_test --mysql-port=3306 --mysql-host=10.xx.xx.xxx --mysql-db=sb_test --max-requests=0 --time=10 --report-interval=1 --threads=10 --oltp-point-selects=1 --oltp-simple-ranges=0 --oltp_sum_ranges=0 --oltp_order_ranges=0 --oltp_distinct_ranges=0 --oltp-read-only=on cleanup