sysbench对MySQL的压测

QPS - query per second

TPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的

Ⅰ、sysbench测试框架

Ⅱ、常用测试脚本

[[email protected]_42_63_centos lua]# pwd
/usr/local/src/sysbench-master/src/lua
[[email protected]_42_63_centos lua]# ll
total 132
-rwxr-xr-x 1 root root  1446 Jun 27 02:35 bulk_insert.lua
-rw-r--r-- 1 root root  1307 Jun 27 02:35 empty-test.lua
drwxr-xr-x 2 root root  4096 Jul 12 16:22 internal
-rw-r--r-- 1 root root 25578 Jul 12 16:22 Makefile
-rw-r--r-- 1 root root  1219 Jun 27 02:35 Makefile.am
-rw-r--r-- 1 root root 24760 Jul 12 16:22 Makefile.in
-rw-r--r-- 1 root root 14468 Jun 27 02:35 oltp_common.lua
-rwxr-xr-x 1 root root  1290 Jun 27 02:35 oltp_delete.lua
-rwxr-xr-x 1 root root  2415 Jun 27 02:35 oltp_insert.lua
-rwxr-xr-x 1 root root  1265 Jun 27 02:35 oltp_point_select.lua
-rwxr-xr-x 1 root root  1649 Jun 27 02:35 oltp_read_only.lua
-rwxr-xr-x 1 root root  1824 Jun 27 02:35 oltp_read_write.lua
-rwxr-xr-x 1 root root  1118 Jun 27 02:35 oltp_update_index.lua
-rwxr-xr-x 1 root root  1127 Jun 27 02:35 oltp_update_non_index.lua
-rwxr-xr-x 1 root root  1440 Jun 27 02:35 oltp_write_only.lua
-rw-r--r-- 1 root root  1631 Jun 27 02:35 prime-test.lua
-rwxr-xr-x 1 root root  1933 Jun 27 02:35 select_random_points.lua
-rwxr-xr-x 1 root root  2132 Jun 27 02:35 select_random_ranges.lua

Ⅲ、开搞

这个老版本好像有参数设置热数据的量什么的,现在最新版本不知道咋搞,就先将就直接弄吧,不管了

准备数据
[[email protected]_42_63_centos lua]# sysbench --mysql-host=127.0.0.1 --mysql-port=3307 --mysql-db=sbtest --tables=10 --table-size=10000 --mysql-user=root --mysql-password=123 --mysql-db=sbtest oltp_update_index.lua prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Creating table ‘sbtest1‘...
Inserting 10000 records into ‘sbtest1‘
Creating a secondary index on ‘sbtest1‘...
Creating table ‘sbtest2‘...
Inserting 10000 records into ‘sbtest2‘
Creating a secondary index on ‘sbtest2‘...
Creating table ‘sbtest3‘...
Inserting 10000 records into ‘sbtest3‘
Creating a secondary index on ‘sbtest3‘...
...

开始测试
[[email protected]_42_63_centos lua]# sysbench oltp_update_index.lua --mysql-host=127.0.0.1 --mysql-port=3307 --mysql-user=root --mysql-password=123 --threads=10 --time=120 --report-interval=10 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 10
Report intermediate results every 10 second(s)
Initializing random number generator from current time

Initializing worker threads...

Threads started!

[ 10s ] thds: 10 tps: 804.14 qps: 804.14 (r/w/o: 0.00/804.14/0.00) lat (ms,95%): 36.89 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 10 tps: 647.70 qps: 647.70 (r/w/o: 0.00/647.70/0.00) lat (ms,95%): 35.59 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 10 tps: 2220.50 qps: 2220.50 (r/w/o: 0.00/2220.50/0.00) lat (ms,95%): 18.28 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 10 tps: 4566.59 qps: 4566.59 (r/w/o: 0.00/4566.59/0.00) lat (ms,95%): 2.71 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 10 tps: 4194.30 qps: 4194.30 (r/w/o: 0.00/4194.30/0.00) lat (ms,95%): 7.30 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 10 tps: 4717.91 qps: 4717.91 (r/w/o: 0.00/4717.91/0.00) lat (ms,95%): 2.76 err/s: 0.00 reconn/s: 0.00
...

看结果,这里就不解释了,比较简单,随便看看就好
SQL statistics:
    queries performed:
        read:                            0
        write:                           665574
        other:                           0
        total:                           665574
    transactions:                        665574 (5546.21 per sec.)
    queries:                             665574 (5546.21 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

Throughput:
    events/s (eps):                      5546.2076
    time elapsed:                        120.0052s
    total number of events:              665574

Latency (ms):
         min:                                    0.27
         avg:                                    1.80
         max:                                  123.45
         95th percentile:                        2.43
         sum:                              1199263.13

Threads fairness:
    events (avg/stddev):           66557.4000/209.28
    execution time (avg/stddev):   119.9263/0.00

原文地址:https://www.cnblogs.com/---wunian/p/9299386.html

时间: 2024-08-03 06:39:08

sysbench对MySQL的压测的相关文章

sysbench对MySQL的压测,使用sysbench压测磁盘io

QPS - query per secondTPS - transaction per second 不是特别关注,每个业务场景中事务标准是不一样的 Ⅰ.sysbench测试框架 Ⅱ.常用测试脚本 [[email protected]_42_63_centos lua]# pwd /usr/local/src/sysbench-master/src/lua [[email protected]_42_63_centos lua]# ll *.lua -rwxr-xr-x 1 root root

MySQL mysqlslap压测

200 ? "200px" : this.width)!important;} --> 介绍 mysqlslap是mysql自带的一个性能压测工具:mysqlslap用于和其它的一些性能压测工具一样可以自己造数据进行压测.mysqlslap的报告比较简单主要体现在执行的时间方面,没有sysbench那样的tps.qps等更详细的包括. 参数 --auto-generate-sql -a 自动生成MySQL测试语句 --auto-generate-sql-add-autoincre

sysbench压测配置文件

Sysbench 基准压测 my.cnf [TOC] ############################################ line: V1.1 mail: [email protected] date: 2017-11-10 ########################################### 一.Sysench测试前准备 1.1.压测环境 配置 信息 主机 Dell PowerEdge R730xd CPU 24 * Intel(R) Xeon(R) C

025:sysbench压测-innodb_flush_log_at_trx_commit,sync_binlog参数对性能的影响

sysbench压测-innodb_flush_log_at_trx_commit,sync_binlog参数对性能的影响 [TOC] 一.OLTP测试前准备 基本信息: 主机信息 CPU 内存 硬盘 系统版本 MySQL版本 sysbench版本 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz *2 2G 虚拟机硬盘 CentOS release 6.9 (Final) 5.7.18 1.1.0-76 sysbench 目录(/software/sysbenc

MySQL压测工具--TPCC安装,测试

今天我们来讲一下MySQL的压力测试工具,目前我接触到的主要有两种压力测试工具:TPCC,Sysbench,前者只适合MySQL数据库OLTP压力测试,而Sysbench功能就比较广泛,可以测试OS的CPU,Memory,IO,以及多种关系型数据库,如MySQL,PostgreSQL; 这篇博客主要讲解Tpcc 安装,测试. 简介 TPC-C是专门针对联机交易处理系统(OLTP系统)的规范,一般情况下我们也把这类系统称为业务处理系统: tpcc-mysql是percona基于TPC-C衍生出来的

压测mysql连接数

Mysql server 支持的最大连接数 主机的性能直接影响到Mysql server端支持的最大并发连接数,如内存不足会造成连接创建失败. /etc/my.conf  配置Mysql server 可接收的最大连接数,主机的性能直接决定能创建的最大连接数. 用 mysqlslap 工具来压测Mysql server支持的最大连接数,主机配置:Intel(R) Xeon(R) E5506  2.13GHz  (4核 8线程)*2/内存32GB/SAS 300G 步骤如下: 修改 /etc/my

MySQL 5.6 VS 5.7压测报告

  MySQL 5.6 VS 5.7压测报告   版本 姓名 时间 V1.0 刘占彬 2016.3.2   测试条件 1.        软件 OS:  CentOS release 6.7 (Final) 文件格式:xfs MySQL:percona5.6.24  VS  5.7.10 关键参数配置(yum install后初始化默认,未做修改): bufferpool大小16G sync_binlog=0 innodb_flush_log_at_trx_commit= 2 压测工具:sysb

Sysbench 基准压测 IO篇

line:V1.1 mail: [email protected] date: 2017-11-17 一.Sysench测试前准备 1.1.压测环境 配置 信息 主机 Dell PowerEdge R730xd CPU 24 * Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz 内存 64G (16G * 4) RAID RAID1 硬盘 7.2K RPM, 6000G SAS, 12G/s 文件系统 ext4 系统 Red Hat Enterprise Lin

MySQL压测--注意事项和FAQ

上次我们讲了TPCC的安装和一些使用方法,今天先不着急真正的做MySQL压力测试,先把我最近做压力测试的遇到的一些问题罗列出来,这样 后面做测试可以事半功倍. 1.注意事项 (1).提前规划好具体要测试什么,即测试目的,比如 MySQL5.6与5.7的性能差异: 异步复制和半同步复制的TPS: 设置双1(innodb_flush_log_at_trx_commit=1.sync_binlog=1)性能对数据库性能影响多少: 确认即将上线的新业务对MySQL负载影响多少,是否能承载得住,是否需要对