组装sysbench并进行MySQL压力测试讲义
发布时间:2023-08-19 14:57:43 所属栏目:MySql教程 来源:
导读:本文主要给大家介绍安装sysbench并进行MySQL压力测试讲义,其所涉及的东西,从理论知识来获悉,有很多书籍、文献可供大家参考,从现实意义角度出发,亿速云累计多年的实践经验可分享给大家。
1. 安装 sysbench
1. 安装 sysbench
本文主要给大家介绍安装sysbench并进行MySQL压力测试讲义,其所涉及的东西,从理论知识来获悉,有很多书籍、文献可供大家参考,从现实意义角度出发,亿速云累计多年的实践经验可分享给大家。 1. 安装 sysbench [root@benchserver ~]# yum install sysbench [root@benchserver ~]# rpm -ql sysbench-1.0.17-2.el7.x86_64 | grep lua$ sysbench使用lua脚本编写,所以最终测试都需要调用lua脚本。 [root@benchserver ~]# sysbench --help 实际使用中参数不多,核心参数如下: General options: --config-file=FILENAME File containing command line options --threads=N number of threads to use [1] --time=N limit for total execution time in seconds [10] --report-interval=N periodically report intermediate statistics with a specified interval in seconds. --db-driver=STRING specifies database driver to use [mysql] Compiled-in database drivers: mysql - MySQL driver pgsql - PostgreSQL driver 安装sysbench并进行MySQL压力测试讲义 mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=[LIST,...] MySQL server port [3306] --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] 2. MySQL数据库创建压力测试用账号 (root@localhost 18:38) [(none)]> create user 'admin'@'10.9.82.187' identified by 'oracle'; (root@localhost 18:39) [(none)]> flush privileges; (root@localhost 18:39) [(none)]> create database sbtest; (root@localhost 18:39) [(none)]> grant all on sbtest.* to 'admin'@'10.9.82.187'; 3. 压力测试主机测试远程登录 [root@benchserver ~]# mysql -h 10.9.59.32 -u admin -poracle -D sbtest 4. 创建压力测试脚本 [root@benchserver ~]# mkdir sysbench [root@benchserver ~]# cd sysbench/ [root@benchserver sysbench]# vi mysql_config mysql-host=10.9.59.32 mysql-port=3306 mysql-user=admin mysql-password=oracle mysql-db=sbtest time=6000 threads=8 report-interval=1 db-driver=mysql 5. 数据初始化 [root@benchserver sysbench]# sysbench --config-file=mysql_config oltp_point_select --tables=16 --table-size=100000 prepare prepare 为初始化测试 6. 压力测试 [root@benchserver sysbench]# sysbench --config-file=mysql_config oltp_point_select --tables=16 --table-size=100000 run | tee oltp_point_select.rpt run 为实际压力测试 Initializing worker threads... Threads started! [ 1s ] thds: 16 tps: 25021.07 qps: 25021.07 (r/w/o: 25021.07/0.00/0.00) lat (ms,95%): 0.90 err/s: 0.00 reconn/s: 0.00 [ 24s ] thds: 16 tps: 26823.29 qps: 26823.29 (r/w/o: 26823.29/0.00/0.00) lat (ms,95%): 0.84 err/s: 0.00 reconn/s: 0.00 (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐