MySQL/Mariadb基准测试工具-tpcc-mysql使用2

tpcc-mysql 是percona基于TPCC标准的mysql实现,专用于mysql基准测试。在上一篇说到tpcc-mysql 的安装和编译,本篇开始说它的使用。

根据叶大神的分析,官方基准测试仅适应于主键已生成的项目,对于由数据库自动生成主键的测试他有一篇博客和工具专门进行了描述。传送门:http://imysql.com/2014/10/11/percona-tpcc-mysql-branch-release.shtml

3.初始化

1)ReadMe 和帮助

README.md
[root@localhost tpcc-mysql-master]# cat README.md 
1. Build binaries
   * `cd src ; make`
   ( you should have mysql_config available in $PATH)

2. Load data
   * create database
     `mysqladmin create tpcc1000`
   * create tables
     `mysql tpcc1000 < create_table.sql`
   * create indexes and FK ( this step can be done after loading data)
     `mysql tpcc1000 < add_fkey_idx.sql`
   * populate data
     - simple step
       `tpcc_load -h127.0.0.1 -d tpcc1000 -u root -p "" -w 1000`
                 |hostname:port| |dbname| |user| |password| |WAREHOUSES|
       ref. tpcc_load --help for all options
     - load data in parallel 
       check load.sh script

3. Start benchmark
   * `./tpcc_start -h127.0.0.1 -P3306 -dtpcc1000 -uroot -w1000 -c32 -r10 -l10800`
   * |hostname| |port| |dbname| |user| |WAREHOUSES| |CONNECTIONS| |WARMUP TIME| |BENCHMARK TIME|
   * ref. tpcc_start --help for all options 

Output
===================================

With the defined interval (-i option), the tool will produce the following output:
``
  10, trx: 12920, 95%: 9.483, 99%: 18.738, max_rt: 213.169, 12919|98.778, 1292|101.096, 1293|443.955, 1293|670.842
  20, trx: 12666, 95%: 7.074, 99%: 15.578, max_rt: 53.733, 12668|50.420, 1267|35.846, 1266|58.292, 1267|37.421
  30, trx: 13269, 95%: 6.806, 99%: 13.126, max_rt: 41.425, 13267|27.968, 1327|32.242, 1327|40.529, 1327|29.580
  40, trx: 12721, 95%: 7.265, 99%: 15.223, max_rt: 60.368, 12721|42.837, 1271|34.567, 1272|64.284, 1272|22.947
  50, trx: 12573, 95%: 7.185, 99%: 14.624, max_rt: 48.607, 12573|45.345, 1258|41.104, 1258|54.022, 1257|26.626
``

Where: 
* 10 - the seconds from the start of the benchmark
* trx: 12920 - New Order transactions executed during the gived interval (in this case, for the previous 10 sec). Basically this is the throughput per interval. The more the better
* 95%: 9.483: - The 95% Response time of New Order transactions per given interval. In this case it is 9.483 sec
* 99%: 18.738: - The 99% Response time of New Order transactions per given interval. In this case it is 18.738 sec
* max_rt: 213.169: - The Max Response time of New Order transactions per given interval. In this case it is 213.169 sec
* the rest: `12919|98.778, 1292|101.096, 1293|443.955, 1293|670.842` is throughput and max response time for the other kind of transactions and can be ignored
  • 10 - 从基准开始的秒数
  • trx:12920 - 在订购间隔期间执行的新订单交易(在本例中为10秒)。 基本上这是每个间隔的吞吐量。 越多越好
  • 95%:9.483: - 每次给定间隔的新订单交易的95%响应时间。 在这种情况下是9.483秒
  • 99%:18.738: - 每次给定间隔的新订单交易的99%响应时间。 在这种情况下是18.738秒
  • max_rt:213.169: - 每次给定间隔的新订单交易的最大响应时间。 在这种情况下是213.169秒
    *其余:12919 | 98.778,1292 | 101.096,1293 | 443.955,1293 | 670.842是另一种交易的吞吐量和最大响应时间,可以忽略
tpcc_load帮助
[root@localhost tpcc-mysql-master]# ./tpcc_load --help
*************************************
*** TPCC-mysql Data Loader        ***
*************************************
./tpcc_load: invalid option -- '-'
Usage: tpcc_load -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -l part -m min_wh -n max_wh
* [part]: 1=ITEMS 2=WAREHOUSE 3=CUSTOMER 4=ORDERS

参数说明:
-h server_host: 服务器名
-P port : 端口号,默认为3306
-d database_name: 数据库名
-u mysql_user : 用户名
-p mysql_password : 密码
-w warehouses: 仓库的数量
–下面三个参数等你在执行一次数据初始化以后就有了理解了,初始化确实太慢了,需要有加快执行的方法,大神们也已经替我们想到了,如果想创建的仓库确实比较对,可以并行初始化数据也可选择部分初始化。
-l part: 选择初始化的部分1=ITEMS 2=WAREHOUSE 3=CUSTOMER 4=ORDERS
-m min_wh: 选择初始化开始库
-n max_wh: 选择初始化结束库

在这里对part不理解的我们再回顾一下tpcc的模型,它的流程是首先需要订单–产生支付–仓库发货–物流–确认收货,等类似于电商的过程,然后来模拟高并发来完成一个典型电商的业务。

tpcc-mysql的业务逻辑及其相关的几个表作用如下:
·New-Order:新订单,主要对应 new_orders 表
·Payment:支付,主要对应 orders、history 表
·Order-Status:订单状态,主要对应 orders、order_line 表
·Delivery:发货,主要对应 order_line 表
·Stock-Level:库存,主要对应 stock 表

其他相关表:
·客户:主要对应 customer 表
·地区:主要对应 district 表
·商品:主要对应 item 表
·仓库:主要对应 warehouse 表

tpcc_start帮助
[root@localhost tpcc-mysql-master]# ./tpcc_start --help
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
./tpcc_start: invalid option -- '-'
Usage: tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -c connections -r warmup_time -l running_time -i report_interval -f report_file -t trx_file

参数说明:
-h server_host: 服务器名
-P port : 端口号,默认为3306
-d database_name: 数据库名
-u mysql_user : 用户名
-p mysql_password : 密码
-w warehouses: 仓库的数量
-c connections : 线程数,默认为1
-r warmup_time : 热身时间,单位:s,默认为10s ,热身是为了将数据加载到内存。
-l running_time: 测试时间,单位:s,默认为20s
-i report_interval: 指定生成报告间隔时长
-f report_file: 测试结果输出文件
-t trx_file:

2)初始化

(1)创建库\表\索引

[root@localhost tpcc-mysql-master]# mysql -u root -p*** -e "create database tpcc100" #创建数据库
[root@localhost tpcc-mysql-master]# mysql -u root -p*** tpcc100 < create_table.sql  #创建表
[root@localhost tpcc-mysql-master]# mysql -u root -p*** tpcc100 < add_fkey_idx.sql  #创建索引
[root@localhost tpcc-mysql-master]# mysql -u root -p*** tpcc100 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 10.2.9-MariaDB MariaDB Server

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

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

MariaDB [tpcc100]> show tables;
+-------------------+
| Tables_in_tpcc100 |
+-------------------+
| customer          |
| district          |
| history           |
| item              |
| new_orders        |
| order_line        |
| orders            |
| stock             |
| warehouse         |
+-------------------+
9 rows in set (0.00 sec)

MariaDB [tpcc100]> exit
Bye

(2)数据初始化

注意在这里,需要注意的是 tpcc 默认会读取 /var/lib/mysql/mysql.sock 这个socket 文件。因此,如果你的 socket 文件不在相应路径的话,会报2002错误【2002,HY000,Can’t connect to local MySQL server through socket ‘/tmp/mysqld.sock’】,可以做个软连接,或者通过TCP/IP的方式连接测试服务器

[root@localhost tpcc-mysql-master]# ln -s /usr/local/mysql/data/mysql.sock /var/lib/mysql/mysql.sock

真实测试场景中,仓库数一般不建议少于100个,视服务器硬件配置而定,如果是配备了SSD或者PCIE SSD这种高IOPS设备的话,建议最少不低于1000个。

仓库越多,数据填充时间越长。可以喝杯茶回来再继续。

开始创建 100 个数据仓库并填充数据。 造数据成功后,会提示:…DATA LOADING COMPLETED SUCCESSFULLY。以下是执行过程,会依次按照1=ITEMS 2=WAREHOUSE 3=CUSTOMER 4=ORDERS 进行初始化。

[root@localhost tpcc-mysql-master]# ./tpcc_load -h 127.0.0.1 -P 3306 -d tpcc100 -u root -p qwe123 -w 100
*************************************
*** TPCC-mysql Data Loader        ***
*************************************
option h with value '127.0.0.1'
option P with value '3306'
option d with value 'tpcc100'
option u with value 'root'
option p with value 'qwe123'
option w with value '100'
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: tpcc100
       [user]: root
       [pass]: qwe123
  [warehouse]: 100
TPCC Data Load Started...
Loading Item 
.................................................. 5000
.................................................. 10000
.................................................. 15000
.................................................. 20000
.................................................. 25000
.................................................. 30000
.................................................. 35000
.................................................. 40000
.................................................. 45000
.................................................. 50000
.................................................. 55000
.................................................. 60000
.................................................. 65000
.................................................. 70000
.................................................. 75000
.................................................. 80000
.................................................. 85000
.................................................. 90000
.................................................. 95000
.................................................. 100000
Item Done. 
Loading Warehouse 
Loading Stock Wid=1
.................................................. 5000 10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 100000
 Stock Done.
Loading District
Loading Stock Wid=2
.................................................. 5000 10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 100000
 Stock Done.
Loading District
Loading Stock Wid=3
.................................................. 5000 10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 100000
 Stock Done.
Loading District

...

Loading Stock Wid=100
.................................................. 5000 10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 100000
 Stock Done.
Loading District
Loading Customer for DID=1, WID=1
.......... 1000
.......... 2000
.......... 3000
Customer Done.
Loading Customer for DID=2, WID=1
.......... 1000
.......... 2000
.......... 3000
Customer Done.

...

Loading Customer for DID=10, WID=100
.......... 1000
.......... 2000
.......... 3000
Customer Done.
Loading Orders for D=1, W= 1
.......... 1000
.......... 2000
.......... 3000
Orders Done.
Loading Orders for D=2, W= 1
.......... 1000
.......... 2000
.......... 3000
Orders Done.

...

Loading Orders for D=10, W= 100
.......... 1000
.......... 2000
.......... 3000
Orders Done.

...DATA LOADING COMPLETED SUCCESSFULLY.
[root@localhost tpcc-mysql-master]# 

确实执行了很久。我在开始执行数据填充后,从大神叶金荣的博客上看到了并行执行数据填充的说明,顿时后悔手怎么那么欠呢。可惜叶大神分享的tpcc_load_parallel.sh地址已不能访问,再回过头来看README.md,中间有一段提到了load data in parallel ,根据新版tpcc_load对load.sh略作改造如下:

#export LD_LIBRARY_PATH=/usr/local/mysql/lib/mysql/

#./tpcc_load -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -l part -m min_wh -n max_wh

HOST=127.0.0.1      #服务器名
PORT=3307           #端口号
DBNAME=tpcc110      #数据库名
USER=tpcc           #用户名
PWD=***             #密码
WH=50               #仓库的数量
STEP=10             #步长,小于仓库数量

./tpcc_load -h $HOST -P $PORT -d $DBNAME -u $USER -p $PWD -w $WH -l 1 -m 1 -n $WH >> 1.out &

x=1

while [ $x -le $WH ]
do
 echo $x $(( $x + $STEP - 1 ))
./tpcc_load -h $HOST -P $PORT -d $DBNAME -u $USER -p $PWD -w $WH -l 2 -m $x -n $(( $x + $STEP - 1 ))  >> 2_$x.out &
./tpcc_load -h $HOST -P $PORT -d $DBNAME -u $USER -p $PWD -w $WH -l 3 -m $x -n $(( $x + $STEP - 1 ))  >> 3_$x.out &
./tpcc_load -h $HOST -P $PORT -d $DBNAME -u $USER -p $PWD -w $WH -l 4 -m $x -n $(( $x + $STEP - 1 ))  >> 4_$x.out &
 x=$(( $x + $STEP ))
done

附:tpcc_load_parallel.sh并行灌入数据脚本

#!/bin/bash

# Configration

MYSQL=/mysql/5.6/bin/mysql
TPCCLOAD=./tpcc_load
TABLESQL=./create_table.sql
CONSTRAINTSQL=./add_fkey_idx.sql
DEGREE=`getconf _NPROCESSORS_ONLN`

SERVER=10.1.1.1
PORT=3306
DATABASE=tpcc
USER=tpcc
PASS=123456
WAREHOUSE=100
SOCKET=/tmp/mysql.sock
# Load

set -e
$MYSQL -u $USER -p$PASS -S $SOCKET -e "DROP DATABASE IF EXISTS $DATABASE"
$MYSQL -u $USER -p$PASS -S $SOCKET -e "CREATE DATABASE $DATABASE"
$MYSQL -u $USER -p$PASS -S $SOCKET $DATABASE < $TABLESQL
$MYSQL -u $USER -p$PASS -S $SOCKET $DATABASE < $CONSTRAINTSQL

echo 'Loading item ...'
$TPCCLOAD -h $SERVER -P $PORT -d $DATABASE -u $USER -p $PASS -w $WAREHOUSE -l 1 > /dev/null

set +e
STATUS=0
trap 'STATUS=1; kill 0' INT TERM

for ((WID = 1; WID <= WAREHOUSE; WID++)); do
    echo "Loading warehouse id $WID ..."

    (
        set -e

        # warehouse, stock, district
        $TPCCLOAD -h $SERVER -P $PORT -d $DATABASE -u $USER -p $PASS  -w $WAREHOUSE -l 2 -m $WID -n $WID > /dev/null

        # customer, history
        $TPCCLOAD -h $SERVER -P $PORT -d $DATABASE -u $USER -p $PASS  -w $WAREHOUSE -l 3 -m $WID -n $WID > /dev/null

        # orders, new_orders, order_line
        $TPCCLOAD -h $SERVER -P $PORT -d $DATABASE -u $USER -p $PASS  -w $WAREHOUSE -l 4 -m $WID -n $WID > /dev/null
    ) &

    PIDLIST=(${PIDLIST[@]} $!)

    if [ $((WID % DEGREE)) -eq 0 ]; then
        for PID in ${PIDLIST[@]}; do
            wait $PID

            if [ $? -ne 0 ]; then
                STATUS=1
            fi
        done

        if [ $STATUS -ne 0 ]; then
            exit $STATUS
        fi

        PIDLIST=()
    fi
done

for PID in ${PIDLIST[@]}; do
    wait $PID

    if [ $? -ne 0 ]; then
        STATUS=1
    fi
done

if [ $STATUS -eq 0 ]; then
    echo 'Completed.'
fi

exit $STATUS 

(3)预热并执行

真实测试场景中,建议预热时间不小于5分钟,持续压测时长不小于30分钟,否则测试数据可能不具参考意义。

对 100 个数据仓库,预热 120 秒,100 个并发连接,运行 3600 秒, 结果存放在文件 tpcc100_20171016 中。

[root@localhost tpcc-mysql-master]# ./tpcc_start --help
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
./tpcc_start: invalid option -- '-'
Usage: tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -c connections -r warmup_time -l running_time -i report_interval -f report_file -t trx_file
[root@localhost tpcc-mysql-master]# ./tpcc_start -h 127.0.0.1 -P 3306 -d tpcc100  -u root -p '***' -w 100 -c 100 -r 120 -l 3600 -f tpcc100_20171016

4.结果解读

1) tpcc-mysql执行结果分析

***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '127.0.0.1'         -- 主机
option P with value '3306'              -- 端口
option d with value 'tpcc100'           -- 数据库
option u with value 'root'              -- 账号
option p with value '***'               -- 密码
option w with value '100'               -- 仓库数
option c with value '100'               -- 并发线程数
option r with value '120'               -- 数据预热时长
option l with value '3600'              -- 压测时长
option f with value 'tpcc100_20171016'  -- 输出报告日志文件
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: tpcc100
       [user]: root
       [pass]: ***
  [warehouse]: 100
 [connection]: 100
     [rampup]: 120 (sec.)
    [measure]: 3600 (sec.)

-- 预热
RAMP-UP TIME.(120 sec.)
neword 67:2
1205, HY000, Lock wait timeout exceeded; try restarting transaction
payment 0:3
1205, HY000, Lock wait timeout exceeded; try restarting transaction

-- 预热结束,开始进行压测
MEASURING START.

  10, trx: 6, 95%: 70618.500, 99%: 104995.385, max_rt: 113045.259, 15|75749.282, 2|21176.066, 2|127601.851, 0|115242.438
  20, trx: 8, 95%: 83057.565, 99%: 83057.565, max_rt: 83067.916, 26|55577.196, 3|8565.703, 1|0.000, 1|138508.901
payment 0:3
1205, HY000, Lock wait timeout exceeded; try restarting transaction
  30, trx: 1, 95%: 34863.856, 99%: 34863.856, max_rt: 34860.202, 0|0.000, 0|0.000, 1|137894.699, 1|120450.424
  40, trx: 11, 95%: 62612.056, 99%: 81579.139, max_rt: 81581.319, 7|27677.166, 0|0.000, 0|0.000, 1|119471.296
payment 83:3
1205, HY000, Lock wait timeout exceeded; try restarting transaction
  50, trx: 5, 95%: 142827.406, 99%: 142827.406, max_rt: 142839.767, 18|50520.812, 2|16444.124, 1|107002.708, 0|0.000
  60, trx: 16, 95%: 66894.168, 99%: 68803.159, max_rt: 68805.335, 5|64663.769, 0|0.000, 1|126138.487, 1|146192.675
payment 23:3

...

3600, trx: 9, 95%: 94948.864, 99%: 94948.864, max_rt: 94940.673, 8|17504.640, 0|0.000, 2|145419.867, 0|0.000

-- 以逗号分隔,共9列
-- 第一列,第N次10秒
-- 第二列,trx:9 - 在订购间隔期间执行的新订单交易(在本例中为10秒)。 基本上这是每个间隔的吞吐量。 越多越好
-- 第三列,95%:94948.864: - 每次给定间隔的新订单交易的95%响应时间。 在这种情况下是94948.864秒
-- 第四列,99%:94948.864: - 每次给定间隔的新订单交易的99%响应时间。 在这种情况下是94948.864秒
-- 第五列,max_rt:213.169: - 每次给定间隔的新订单交易的最大响应时间。 在这种情况下是94940.673秒
-- 8|17504.640, 0|0.000, 2|145419.867, 0|0.000 是另一种交易的吞吐量和最大响应时间,可以忽略
-- 第六列,8|17504.640 支付业务
-- 第七列,0|0.000 订单状态业务
-- 第八列,2|145419.867 物流发货业务
-- 第九列,0|0.000 库存仓储业务

-- 压测结束
STOPPING THREADS......................neword 81:2
1205, HY000, Lock wait timeout exceeded; try restarting transaction
..............................................................................
-- 第一次结果统计
<Raw Results>
  [0] sc:0 lt:3610  rt:40  fl:0 avg_rt: 56150.0 (5) -- New-Order,新订单业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数,TODO:平均重试次数(avg_rt)
  [1] sc:4 lt:3617  rt:39  fl:0 avg_rt: 16099.2 (5) -- Payment,支付业务统计,其他同上
  [2] sc:0 lt:362  rt:0  fl:0 avg_rt: 10077.6 (5)   -- Order-Status,订单状态业务统计,其他同上
  [3] sc:0 lt:363  rt:0  fl:0 avg_rt: 133366.1 (80) -- Delivery,发货业务统计,其他同上
  [4] sc:0 lt:356  rt:0  fl:0 avg_rt: 172714.1 (20) -- Stock-Level,库存业务统计,其他同上
 in 3600 sec.

-- 第二次统计结果,其他同上
<Raw Results2(sum ver.)>
  [0] sc:0  lt:3610  rt:40  fl:0 
  [1] sc:4  lt:3617  rt:39  fl:0 
  [2] sc:0  lt:362  rt:0  fl:0 
  [3] sc:0  lt:363  rt:0  fl:0 
  [4] sc:0  lt:356  rt:0  fl:0 

<Constraint Check> (all must be [OK])  -- 下面所有业务逻辑结果都必须为 OK 才行
 [transaction percentage]
        Payment: 43.56% (>=43.0%) [OK] -- 支付成功次数(上述统计结果中 sc + lt)必须大于43.0%,否则结果为NG,而不是OK
   Order-Status: 4.36% (>= 4.0%) [OK]  -- 订单状态,其他同上
       Delivery: 4.37% (>= 4.0%) [OK]  -- 发货,其他同上
    Stock-Level: 4.28% (>= 4.0%) [OK]  -- 库存,其他同上
 [response time (at least 90% passed)] -- 响应耗时指标必须超过90%通过才行
      New-Order: 0.00%  [NG] *         -- 下面几个响应耗时指标全部NG
        Payment: 0.11%  [NG] *
   Order-Status: 0.00%  [NG] *
       Delivery: 0.00%  [NG] *
    Stock-Level: 0.00%  [NG] *

<TpmC>
                 60.167 TpmC           -- TpmC结果值(每分钟事务数,该值是第一次统计结果中的新订单事务数除以总耗时分钟数,例如本例中是:?/2 = 60.167)不知道我的机器是怎么算的,下次在生产环境测试在看吧。
[root@localhost tpcc-mysql-master]# 

2) 老版本tpcc-mysql结果分析,来自【iMySQL】

-- 本轮tpcc压测的一些基本信息
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '1.2.3.4'           -- 主机
option P with value '3306'              -- 端口
option d with value 'tpcc10'            -- 数据库
option u with value 'tpcc'              -- 账号
option p with value 'tpcc'              -- 密码
option w with value '10'                -- 仓库数
option c with value '64'                -- 并发线程数
option r with value '30'                -- 数据预热时长
option l with value '120'               -- 压测时长
option f with value 'tpcclog_20140921_64_THREADS.res'  -- 输出报告日志文件

     [server]: 1.2.3.4
       [port]: 3306
     [DBname]: tpcc10
       [user]: tpcc
       [pass]: tpcc
  [warehouse]: 10
 [connection]: 64
     [rampup]: 30 (sec.)
    [measure]: 120 (sec.)

RAMP-UP TIME.(30 sec.)

-- 预热结束,开始进行压测
MEASURING START.

-- 每10秒钟输出一次压测数据
  10, 8376(0):2.744|3.211, 8374(0):0.523|1.626, 838(0):0.250|0.305, 837(0):3.241|3.518, 839(0):9.086|10.676
  20, 8294(0):2.175|2.327, 8292(0):0.420|0.495, 829(0):0.206|0.243, 827(0):2.489|2.593, 827(0):7.214|7.646110, 8800(0):2.149|2.458, 8792(0):0.424|0.710, 879(0):0.207|0.244, 878(0):2.461|2.556, 878(0):7.042|7.341
 120, 8819(0):2.147|2.327, 8820(0):0.424|0.568, 882(0):0.208|0.237, 881(0):2.483|2.561, 883(0):7.025|7.405
-- 以逗号分隔,共6列
-- 第一列,第N次10秒
-- 第二列,新订单成功执行压测的次数(推迟执行压测的次数):90%事务的响应时间|本轮测试最大响应时间,新订单事务数也被认为是总有效事务数的指标
-- 第三列,支付业务成功执行次数(推迟执行次数):90%事务的响应时间|本轮测试最大响应时间
-- 第四列,订单状态业务的结果,后面几个的意义同上
-- 第五列,物流发货业务的结果,后面几个的意义同上
-- 第六列,库存仓储业务的结果,后面几个的意义同上

-- 压测结束
STOPPING THREADS................................................................

   -- 第一次结果统计
  [0] sc:100589  lt:0  rt:0  fl:0    -- New-Order,新订单业务成功(success,简写sc)次数,延迟(late,简写lt)次数,重试(retry,简写rt)次数,失败(failure,简写fl)次数
  [1] sc:100552  lt:0  rt:0  fl:0    -- Payment,支付业务统计,其他同上
  [2] sc:10059  lt:0  rt:0  fl:0     -- Order-Status,订单状态业务统计,其他同上
  [3] sc:10057  lt:0  rt:0  fl:0     -- Delivery,发货业务统计,其他同上
  [4] sc:10058  lt:0  rt:0  fl:0     -- Stock-Level,库存业务统计,其他同上
 in 120 sec.

    -- 第二次统计结果,其他同上
  [0] sc:100590  lt:0  rt:0  fl:0 
  [1] sc:100582  lt:0  rt:0  fl:0 
  [2] sc:10059  lt:0  rt:0  fl:0 
  [3] sc:10057  lt:0  rt:0  fl:0 
  [4] sc:10059  lt:0  rt:0  fl:0 

 (all must be [OK])       -- 下面所有业务逻辑结果都必须为 OK 才行,如果哪怕有一个不是OK那么久是NG,如果有任何一个结果是NG的话表明本次结果是不能采信的。
 [transaction percentage]
        Payment: 43.47% (>=43.0%) [OK]      -- 支付成功次数(上述统计结果中 sc + lt)必须大于43.0%,否则结果为NG,而不是OK,所以如果不是大于43%那么结果也是不能采信的
   Order-Status: 4.35% (>= 4.0%) [OK]       -- 订单状态,其他同上
       Delivery: 4.35% (>= 4.0%) [OK]       -- 发货,其他同上
    Stock-Level: 4.35% (>= 4.0%) [OK]       -- 库存,其他同上

 [response time (at least 90% passed)]      -- 响应耗时指标必须超过90%通过才行,所谓的响应时长就是小于5毫秒的测试标准,超过5毫秒肯定是不可以的,如果有10%以上的响应时长说明本次结果不可采信的
#下面几个响应耗时指标全部 100% 通过才可以,如果低于90%的话,那么肯定是NG
      New-Order: 100.00%  [OK]              -- 下面几个响应耗时指标全部 100% 通过
        Payment: 100.00%  [OK]
   Order-Status: 100.00%  [OK]
       Delivery: 100.00%  [OK]
    Stock-Level: 100.00%  [OK]


                 50294.500 TpmC             -- TpmC结果值(每分钟事务数,该值是第一次统计结果中的新订单事务数除以总耗时分钟数,例如本例中是:100589/2 = 50294.500)

为了能够清晰的说明以下内容,首先定义一些变量,便于以下的计算和说明。具体如下所示:
success = 执行成功的记录数
late=执行延迟的记录数
pre_success=上一次执行成功的记录数
pre_late=上一次执行失败的记录数

根据以上定义的变量,计算相应字段的结果和说明相应字段的含义。
1、时间间隔内成功的事务(包括成功和延迟的事务):sl=success+late-pre_success-pre_late
2、时间间隔内延迟的事务:l=late-pre_late
3、时间间隔内前90%记录(实际为99%)的平均响应时间:rt90
4、时间间隔内最大的响应时间:max_rt

遗留问题

1.tpcc_start结果分析中有个别参数不明确

参考

感谢以下大神,您的分享使我少走弯路。
[1]xuanzhi201111: https://www.cnblogs.com/xuanzhi201111/p/4148434.html
[2]sincoqiu的博客: http://blog.csdn.net/sincoqiu/article/details/70226268
[3]iMySQL | 老叶茶馆: http://imysql.cn/2014/10/10/tpcc-mysql-full-user-manual.shtml
[4]zuzhou 的BLOG: http://yijiu.blog.51cto.com/433846/1566615
[5]阿杞的博客: http://blog.sina.com.cn/s/blog_beebb7590102welm.html
[6]摩云飞: https://my.oschina.net/moooofly/blog/148630
[7]小濱的博客: http://blog.sina.com.cn/s/blog_747f4c1d0102xbzb.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d 这是MySQL数据库的配置文件,以下是每条配置的翻译: [mysqld] - datadir=/var/lib/mysql:指定MySQL数据库存储的目录。 - socket=/var/lib/mysql/mysql.sock:指定MySQL数据库与客户端通信的套接字文件。 - symbolic-links=0:禁用符号链接以预防各种安全风险。 - 在使用systemd时,user和group设置会被忽略。如果需要以不同的用户或组运行mysqld,请根据mariadb的systemd unit文件自定义配置,具体操作方式请参考http://fedoraproject.org/wiki/Systemd。 [mysqld_safe] - log-error=/var/log/mariadb/mariadb.log:指定MariaDB的错误日志文件路径。 - pid-file=/var/run/mariadb/mariadb.pid:指定MariaDB的进程ID文件路径。 !includedir /etc/my.cnf.d - 包含配置目录中的所有文件。 这些是MySQL/MariaDB数据库的配置项,用于指定数据库存储、通信、安全等方面的设置。具体的配置和参数设置可以根据需求进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值