签到成功

知道了

CNDBA社区CNDBA社区

TDSQL 集群 使用 sysbench 进行性能压测 使用案例

2021-07-29 15:21 2124 0 原创 TDSQL
作者: dave

在之前的博客我们了解了TDSQL 集群中常用的性能测试的几个工具,如下:

TDSQL 集群 POC TPCC 性能测试 常用工具 说明
https://www.cndba.cn/dave/article/4626

sysbench的数据库OLTP测试支持MySQL、PostgreSQL、Oracle,目前主要用于Linux操作系统,开源社区已经将sysbench移植到了Windows,并支持SQL Server的基准测试。本篇我们来看sysbench 的具体使用。

1 安装Sysbench

从gethub上下载安装文件:http://www.cndba.cn/dave/article/4628

https://github.com/akopytov/sysbenchhttp://www.cndba.cn/dave/article/4628http://www.cndba.cn/dave/article/4628

[dave@www.cndba.cn  data]# unzip sysbench-master.zip

[dave@www.cndba.cn  data]# cd sysbench-master/

[dave@www.cndba.cn  sysbench-master]# ./autogen.sh

注意这里的路径,以实际mysql 的路径为准:

http://www.cndba.cn/dave/article/4628

[dave@www.cndba.cn  sysbench-master]# ./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql --with-mysql

[dave@www.cndba.cn  sysbench-master]# make

[dave@www.cndba.cn  sysbench-master]# make install

检查版本:http://www.cndba.cn/dave/article/4628

[dave@www.cndba.cn  sysbench-master]# sysbench --version
sysbench 1.1.0
[dave@www.cndba.cn  sysbench-master]#

编译完成后在sysbench-master/src/目录会产生二进制可执行文件sysbench,同时Lua脚本也在sysbench-master/src/lua目录下。

2 Sysbench 语法说明

2.1 查看帮助

[dave@www.cndba.cn  src]# sysbench --help
Usage:
  sysbench [options]... [testname] [command]

Commands implemented by most tests: prepare run cleanup help

General options:
  --threads=N                     number of threads to use [1]
  --events=N                      limit for total number of events [0]
  --time=N                        limit for total execution time in seconds [10]
  --warmup-time=N                 execute events for this many seconds with statistics disabled before the actual benchmark run with statistics enabled [0]
  --forced-shutdown=STRING        number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]
  --thread-stack-size=SIZE        size of stack per thread [64K]
  --thread-init-timeout=N         wait time in seconds for worker threads to initialize [30]
  --rate=N                        average transactions rate. 0 for unlimited rate [0]
  --report-interval=N             periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
  --report-checkpoints=[LIST,...] dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  --debug[=on|off]                print more debugging info [off]
  --validate[=on|off]             perform validation checks where possible [off]
  --help[=on|off]                 print help and exit [off]
  --version[=on|off]              print version and exit [off]
  --config-file=FILENAME          File containing command line options
  --luajit-cmd=STRING             perform LuaJIT control command. This option is equivalent to 'luajit -j'. See LuaJIT documentation for more information

Pseudo-Random Numbers Generator options:
  --rand-type=STRING   random numbers distribution {uniform, gaussian, pareto, zipfian} to use by default [uniform]
  --rand-seed=N        seed for random number generator. When 0, the current time is used as an RNG seed. [0]
  --rand-pareto-h=N    shape parameter for the Pareto distribution [0.2]
  --rand-zipfian-exp=N shape parameter (exponent, theta) for the Zipfian distribution [0.8]

Log options:
  --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]

  --percentile=N       percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]
  --histogram[=on|off] print latency histogram in report [off]

General database options:

  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers) [mysql]
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]
  --db-debug[=on|off] print database-specific debug information [off]


Compiled-in database drivers:
  mysql - MySQL driver

mysql options:
  --mysql-host=[LIST,...]          MySQL server host [localhost]
  --mysql-port=[LIST,...]          MySQL server port [3306]
  --mysql-socket=[LIST,...]        MySQL socket
  --mysql-user=STRING              MySQL user [sbtest]
  --mysql-password=STRING          MySQL password []
  --mysql-db=STRING                MySQL database name [sbtest]
  --mysql-ssl[=on|off]             use SSL connections, if available in the client library [off]
  --mysql-ssl-key=STRING           path name of the client private key file
  --mysql-ssl-ca=STRING            path name of the CA file
  --mysql-ssl-cert=STRING          path name of the client public key certificate file
  --mysql-ssl-cipher=STRING        use specific cipher for SSL connections []
  --mysql-compression[=on|off]     use compression, if available in the client library [off]
  --mysql-debug[=on|off]           trace all client library calls [off]
  --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]
  --mysql-dry-run[=on|off]         Dry run, pretend that all MySQL client API calls are successful without executing them [off]

Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test

See 'sysbench <testname> help' for a list of options for each test.

You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  src]#

2.2 语法说明

执行sysbench –help,可以看到sysbench的详细使用方法。

sysbench的基本语法如下:

sysbench [options]… [testname] [command]

http://www.cndba.cn/dave/article/4628

下面说明实际使用中,常用的参数和命令。

2.2.1 command

command是sysbench要执行的命令,包括prepare、run和cleanup,顾名思义,prepare是为测试提前准备数据,run是执行正式的测试,cleanup是在测试完成后对数据库进行清理。

2.2.2 testname

testname指定了要进行的测试,在老版本的sysbench中,可以通过—test参数指定测试的脚本;而在新版本中,—test参数已经声明为废弃,可以不使用—test,而是直接指定脚本。

例如,如下两种方法效果是一样的:

sysbench --test=./tests/include/oltp_legacy/oltp.lua
sysbench ./tests/include/oltp_legacy/oltp.lua

测试时使用的脚本为lua脚本,可以使用sysbench自带脚本,也可以自己开发。对于大多数应用,使用sysbench自带的脚本就足够了。

2.2.3 options

sysbench的参数有很多,其中比较常用的包括:

MySQL连接信息参数:

--mysql-host:MySQL服务器主机名,默认localhost;proxy或者db的ip地址
--mysql-port:MySQL服务器端口,默认3306,TDSQL 端口不一样,这里使用proxy或者db的port
--mysql-user:用户名
--mysql-password:密码
--mysql-db:database name

MySQL执行参数:

--threads:客户端的并发连接数
--time:测试执行的时间,单位是秒,该值不要太短,可以选择120
--report-interval:生成报告的时间间隔,单位是秒,如10
--db-driver:指定db driver类型为mysql

2.3 不同lua的帮助查看

实际上,sysbench 有不同的lua脚本,每个脚本的语法也有一些出入:

[dave@www.cndba.cn  lua]# pwd
/data/sysbench-master/src/lua
[dave@www.cndba.cn  lua]# ls
bulk_insert.lua  Makefile.am      oltp_insert.lua        oltp_update_index.lua      select_random_points.lua
empty-test.lua   Makefile.in      oltp_point_select.lua  oltp_update_non_index.lua  select_random_ranges.lua
internal         oltp_common.lua  oltp_read_only.lua     oltp_write_only.lua
Makefile         oltp_delete.lua  oltp_read_write.lua    prime-test.lua
[dave@www.cndba.cn  lua]#

我们这里查看oltp_common.lua的帮助:
[dave@www.cndba.cn  lua]# sysbench oltp_common.lua help
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

oltp_common.lua options:
  --auto_inc[=on|off]           Use AUTO_INCREMENT column as Primary Key (for MySQL), or its alternatives in other DBMS. When disabled, use client-generated IDs [on]
  --create_secondary[=on|off]   Create a secondary index in addition to the PRIMARY KEY [on]
  --create_table_options=STRING Extra CREATE TABLE options []
  --delete_inserts=N            Number of DELETE/INSERT combinations per transaction [1]
  --distinct_ranges=N           Number of SELECT DISTINCT queries per transaction [1]
  --index_updates=N             Number of UPDATE index queries per transaction [1]
  --mysql_storage_engine=STRING Storage engine, if MySQL is used [innodb]
  --non_index_updates=N         Number of UPDATE non-index queries per transaction [1]
  --order_ranges=N              Number of SELECT ORDER BY queries per transaction [1]
  --pgsql_variant=STRING        Use this PostgreSQL variant when running with the PostgreSQL driver. The only currently supported variant is 'redshift'. When enabled, create_secondary is automatically disabled, and delete_inserts is set to 0
  --point_selects=N             Number of point SELECT queries per transaction [10]
  --range_selects[=on|off]      Enable/disable all range SELECT queries [on]
  --range_size=N                Range size for range SELECT queries [100]
  --reconnect=N                 Reconnect after every N events. The default (0) is to not reconnect [0]
  --secondary[=on|off]          Use a secondary index in place of the PRIMARY KEY [off]
  --simple_ranges=N             Number of simple range SELECT queries per transaction [1]
  --skip_trx[=on|off]           Don't start explicit transactions and execute all queries in the AUTOCOMMIT mode [off]
  --sum_ranges=N                Number of SELECT SUM() queries per transaction [1]
  --table_size=N                Number of rows per table [10000]
  --tables=N                    Number of tables [1]

You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  lua]#

我们这里就关注2个参数:http://www.cndba.cn/dave/article/4628

--tables :装载表的个数
--table-size :每张表的行数

3 装载数据

在上节将命令时就看到sysbench的测试有三个步骤:

  1. prepare
  2. run
  3. cleanup

因为TDSQL 集群分shard 和 noshard 实例,所以在数据加载稍有区别。

3.1 Noshard实例加载数据

noshard 和普通的单机mysql 操作没有区别,只要创建好测试数据库就可以进行测试。

创建测试库:CNDBA

http://www.cndba.cn/dave/article/4628

[dave@www.cndba.cn  ~]# mysql -htdsql1 -udave -pdave -P4011
Welcome to the MariaDB monitor.  Commands end with ; or /g.
Your MySQL connection id is 32051
Server version: 5.7.17-11-V2.0R541D002-20200219-2204-log Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| sysdb              |
| test               |
+--------------------+
6 rows in set (0.00 sec)

MySQL [(none)]> create database cndba;
Query OK, 1 row affected (0.00 sec)
MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cndba              |
| mysql              |
| performance_schema |
| sys                |
| sysdb              |
| test               |
+--------------------+
7 rows in set (0.00 sec)

MySQL [(none)]>

使用sysben压入测试数据:我们这里在cndba库中创建10张表,每张表1000条记录:

[dave@www.cndba.cn  src]# pwd
/data/sysbench-master/src

[dave@www.cndba.cn  src]# sysbench lua/oltp_common.lua  --mysql-host=192.168.31.61 --mysql-port=15007 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --tables=10 --table-size=1000 --db-driver=mysql --report-interval=10 --threads=10 --time=120 prepare


sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Initializing worker threads...

Creating table 'sbtest9'...
Creating table 'sbtest3'...
Creating table 'sbtest10'...
Creating table 'sbtest6'...
Creating table 'sbtest4'...
Creating table 'sbtest7'...Creating table 'sbtest8'...
Creating table 'sbtest1'...

Creating table 'sbtest2'...
Creating table 'sbtest5'...
Inserting 1000 records into 'sbtest9'
Inserting 1000 records into 'sbtest3'
Inserting 1000 records into 'sbtest1'
Inserting 1000 records into 'sbtest6'
Inserting 1000 records into 'sbtest7'
Inserting 1000 records into 'sbtest8'
Inserting 1000 records into 'sbtest5'
Inserting 1000 records into 'sbtest4'
Inserting 1000 records into 'sbtest2'
Inserting 1000 records into 'sbtest10'
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest3'...
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest4'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest6'...
Creating a secondary index on 'sbtest1'...
You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  src]#

3.2 Groupshard实例加载数据

groupshard 与noshard 实例操作类似,但是因为groupshard 多了一个shardkey,所以我们需要先修改lua,然后才能创建。

[dave@www.cndba.cn  lua]# pwd
/data/sysbench-master/src/lua
[dave@www.cndba.cn  lua]# cp oltp_common.lua oltp_common_shard.lua
[dave@www.cndba.cn  lua]#

修改2个地方:

  1. 注释掉lua脚本 58-61行
  2. 建表语句199行处添加 shardkey=id

TDSQL 集群 sysbench shard实例 lua脚本 Proxy ERROR:get_auto_inc_id error 错误解决方法
https://www.cndba.cn/dave/article/4627

然后使用新的lua脚本来加载数据,语法是一样的:在cndba库中创建10张表,每张表1000条记录:

[dave@www.cndba.cn  ~]# mysql -htdsql1 -udave -pdave -P15004 -e 'drop database if exists cndba;create database cndba;show databases;'
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cndba              |
| dave               |
| mysql              |
| performance_schema |
| sys                |
| sysdb              |
| test               |
| xa                 |
+--------------------+
You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  ~]#


[dave@www.cndba.cn  src]# sysbench lua/oltp_common_shard.lua  --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --tables=10 --table-size=1000 --db-driver=mysql --report-interval=10 --threads=10 --time=120 prepare
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Initializing worker threads...

Creating table 'sbtest9'...
Creating table 'sbtest1'...
Creating table 'sbtest7'...
Creating table 'sbtest3'...
Creating table 'sbtest4'...
Creating table 'sbtest6'...
Creating table 'sbtest8'...
Creating table 'sbtest2'...
Creating table 'sbtest10'...
Creating table 'sbtest5'...
Inserting 1000 records into 'sbtest4'
Inserting 1000 records into 'sbtest3'
Inserting 1000 records into 'sbtest2'
Inserting 1000 records into 'sbtest8'
Inserting 1000 records into 'sbtest9'
Creating a secondary index on 'sbtest4'...
Inserting 1000 records into 'sbtest5'
Inserting 1000 records into 'sbtest10'
Creating a secondary index on 'sbtest3'...
Inserting 1000 records into 'sbtest6'
Inserting 1000 records into 'sbtest7'
Inserting 1000 records into 'sbtest1'
Creating a secondary index on 'sbtest2'...
Creating a secondary index on 'sbtest5'...
Creating a secondary index on 'sbtest10'...
Creating a secondary index on 'sbtest8'...
Creating a secondary index on 'sbtest9'...
Creating a secondary index on 'sbtest7'...
Creating a secondary index on 'sbtest1'...
Creating a secondary index on 'sbtest6'...
[dave@www.cndba.cn  src]#


MySQL [cndba]>  /*proxy*/show status;
+-----------------------------+------------------------------------------------------------------------------------------------+
| status_name                 | value                                                                                          |
+-----------------------------+------------------------------------------------------------------------------------------------+
| cluster                     | group_1627396748_58                                                                            |
| set_1627396836_1:ip         | 192.168.31.61:4006;192.168.31.62:4006@1@IDC_HF_HSL_888@0,192.168.31.63:4006@1@IDC_HF_HSL_888@0 |
| set_1627396836_1:hash_range | 0---30                                                                                         |
| set_1627397155_3:ip         | 192.168.31.61:4007;192.168.31.62:4007@1@IDC_HF_HSL_888@0,192.168.31.63:4007@1@IDC_HF_HSL_888@0 |
| set_1627397155_3:hash_range | 31---63                                                                                        |
| set                         | set_1627396836_1,set_1627397155_3                                                              |
+-----------------------------+------------------------------------------------------------------------------------------------+
6 rows in set (0.00 sec)

MySQL [cndba]> /*sets:set_1627397155_3*/select count(*) from sbtest1;
+----------+------------------+
| count(*) | info             |
+----------+------------------+
|      502 | set_1627397155_3 |
+----------+------------------+
1 row in set (0.01 sec)

MySQL [cndba]> /*sets:set_1627396836_1*/select count(*) from sbtest1;
+----------+------------------+
| count(*) | info             |
+----------+------------------+
|      498 | set_1627396836_1 |
+----------+------------------+
1 row in set (0.00 sec)

MySQL [cndba]>

4 压测场景

在sysbench的lua脚本目录下有多个不同脚本,对应不同的场景。

[dave@www.cndba.cn  ~]# cd /data/sysbench-master/src/lua
You have new mail in /var/spool/mail/root
[dave@www.cndba.cn  lua]# ls
bulk_insert.lua  oltp_common_bigtab_shard.lua  oltp_point_select.lua      prime-test.lua
empty-test.lua   oltp_common.lua               oltp_read_only.lua         select_random_points.lua
internal         oltp_common_shard1.lua        oltp_read_write.lua        select_random_ranges.lua
Makefile         oltp_common_shard.lua         oltp_update_index.lua
Makefile.am      oltp_delete.lua               oltp_update_non_index.lua
Makefile.in      oltp_insert.lua               oltp_write_only.lua
[dave@www.cndba.cn  lua]#

比如读写,只读,索引更新等。

这些场景涉及到如下几个参数:

http://www.cndba.cn/dave/article/4628

--range_size :查询范围,默认值100行
--point_selects =每个事务包含point select的个数,默认值1
--simple_ranges :每个事务包含range select的个数,默认值1
--sum_ranges =每个事务包含sum() select的个数,默认值1
--order_ranges =每个事务包含order by select的个数,默认值1
--distinct_ranges =每个事务包含distinct select的个数,默认值1
--index_updates =每个事务包含index select的个数,默认值1
--non_index_updates =每个事务包含更新非索引字段的个数,默认值1
--delete_inserts =每个事务包含delete和insert的个数,默认值1
--range_selects =开启或者关闭范围查询,默认值false
--time 运行时间设为0表示不限制时间
--report-interval 运行期间日志,单位为秒
--events 最大请求数量,定义数量后可以不需要--time选项

根据具体的场景,定好参数后,在压测语句后面加上run 命令,表示执行压测,结束后执行把run 换成cleanup,用来清除测试数据。

混合读写场景

[dave@www.cndba.cn  lua]# sysbench  oltp_read_write.lua --table-size=1000 --tables=10 --point_selects=2  --index_updates=2 --non_index_updates=1 --delete_inserts=1 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  --threads=20 run

普通查询

http://www.cndba.cn/dave/article/4628

[dave@www.cndba.cn  lua]# sysbench --threads=20 oltp_point_select.lua --table-size=1000 --tables=10 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  run

仅查询(包含范围查询、sum、order by和distinct)

[dave@www.cndba.cn  lua]# sysbench --threads=20 oltp_read_only.lua --table-size=1000 --tables=10 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  run

索引更新

[dave@www.cndba.cn  lua]# sysbench --threads=20 oltp_update_index.lua --table-size=1000 --tables=10 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  run

非索引更新

[dave@www.cndba.cn  lua]# sysbench --threads=20 oltp_update_non_index.lua --table-size=1000 --tables=10 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  run

仅写(索引更新,非索引更新,delete和insert)

[dave@www.cndba.cn  lua]# sysbench --threads=20 oltp_write_only.lua --table-size=1000 --tables=10 --point_selects=2  --index_updates=2 --non_index_updates=1 --delete_inserts=1 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  run

5 压测结果说明

我们这里开了2个并发,压测了10秒钟,数据和解释如下:

[dave@www.cndba.cn  lua]# sysbench  oltp_read_write.lua --table-size=1000 --tables=10 --point_selects=2  --index_updates=2 --non_index_updates=1 --delete_inserts=1 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba --time=10  --threads=20 run
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

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


Initializing worker threads...

Threads started!

[ 1s ] thds: 20 tps: 173.36 qps: 2473.81 (r/w/o: 1156.70/950.47/366.64) lat (ms,95%): 139.85 err/s: 0.00 reconn/s: 0.00
[ 2s ] thds: 20 tps: 116.02 qps: 1471.25 (r/w/o: 686.12/554.10/231.04) lat (ms,95%): 277.21 err/s: 0.00 reconn/s: 0.00
[ 3s ] thds: 20 tps: 99.97 qps: 1295.71 (r/w/o: 591.93/502.84/200.94) lat (ms,95%): 314.45 err/s: 0.00 reconn/s: 0.00
[ 4s ] thds: 20 tps: 69.74 qps: 933.95 (r/w/o: 435.64/358.82/139.49) lat (ms,95%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 5s ] thds: 20 tps: 48.99 qps: 595.87 (r/w/o: 269.94/227.95/97.98) lat (ms,95%): 707.07 err/s: 0.00 reconn/s: 0.00
[ 6s ] thds: 20 tps: 64.98 qps: 856.75 (r/w/o: 390.89/335.90/129.96) lat (ms,95%): 502.20 err/s: 0.00 reconn/s: 0.00
[ 7s ] thds: 20 tps: 102.06 qps: 1349.79 (r/w/o: 623.37/522.31/204.12) lat (ms,95%): 390.30 err/s: 0.00 reconn/s: 0.00
[ 8s ] thds: 20 tps: 116.98 qps: 1516.71 (r/w/o: 705.86/576.89/233.96) lat (ms,95%): 404.61 err/s: 0.00 reconn/s: 0.00
[ 9s ] thds: 20 tps: 182.98 qps: 2320.75 (r/w/o: 1066.89/887.90/365.96) lat (ms,95%): 176.73 err/s: 0.00 reconn/s: 0.00
[ 10s ] thds: 20 tps: 184.02 qps: 2454.23 (r/w/o: 1137.11/949.09/368.03) lat (ms,95%): 155.80 err/s: 0.00 reconn/s: 0.00
SQL statistics:
    queries performed:
        read:                            7080   //总select数量
        write:                           5900  //总写请求数update、insert、delete语句数量
        other:                           2360   //begin、commit、unlock tables以及其他mutex的数量
        total:                           15340   //总请求数( r+w+o的总和)
    transactions:                        1180 //总事务数  (117.21 per sec.) //每秒处理完成事务数(TPS)
    queries:                             15340//总请求数  (1523.67 per sec.)  //每秒处理的请求数(qps)
    ignored errors:                      0      (0.00 per sec.) //每秒忽略的错误数
    reconnects:                          0      (0.00 per sec.)  //每秒重连数据

Throughput:
    events/s (eps):                      117.2056
    time elapsed:                        10.0678s  //即-times指定的压测时间
    total number of events:              1180   //总的事件数,一般与transactions相同

Latency (ms):
         min:                                   23.45  //请求最少耗时
         avg:                                  170.14  //请求平均耗时
         max:                                  742.80 //请求最长耗时
         95th percentile:                      390.30   //95%的语句的平均响应时间
         sum:                               200762.30  //总耗时


Threads fairness:
    events (avg/stddev):           59.0000/1.76
    execution time (avg/stddev):   10.0381/0.02

[dave@www.cndba.cn  lua]#

6 清除测试环境

[dave@www.cndba.cn  lua]#  sysbench  oltp_read_write.lua --table-size=1000 --tables=10 --point_selects=2  --index_updates=2 --non_index_updates=1 --delete_inserts=1 --report-interval=1 --mysql-host=192.168.31.61 --mysql-port=15004 --mysql-user=dave --mysql-password=dave --mysql-db=cndba  cleanup
sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

Dropping table 'sbtest1'...
Dropping table 'sbtest2'...
Dropping table 'sbtest3'...
Dropping table 'sbtest4'...
Dropping table 'sbtest5'...
Dropping table 'sbtest6'...
Dropping table 'sbtest7'...
Dropping table 'sbtest8'...
Dropping table 'sbtest9'...
Dropping table 'sbtest10'...
[dave@www.cndba.cn  lua]#

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2261
    原创
  • 3
    翻译
  • 578
    转载
  • 191
    评论
  • 访问:7970407次
  • 积分:4346
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ