MySQL 5.7 (5 tpcc-mysql 安装、 测试)

来源:互联网 发布:360vr全景通源码 编辑:程序博客网 时间:2024/05/29 18:33
https://github.com/Percona-Lab/tpcc-mysql


MySQL中文网便捷下载地址:
http://imysql.com/wp-content/uploads/2014/09/tpcc-mysql-src.tgz
下载到本地后,先执行 gunzip 解压缩文件,再执行 tar xf 解包,直接 tar zxf 可能会报告异常。


tpcc-mysql-src.tgz
[root@vm-test1 tools]# gunzip tpcc-mysql-src.tgz 
[root@vm-test1 tools]# tar xf tpcc-mysql-src.tar 
make
[root@vm-test1 tpcc-mysql]# ll
total 264
-rw-r--r-- 1 root root   1621 Sep 14  2014 add_fkey_idx.sql
-rw-r--r-- 1 root root    317 Sep 14  2014 count.sql
-rw-r--r-- 1 root root   3105 Sep 14  2014 create_table.sql
-rw-r--r-- 1 root root    763 Sep 14  2014 drop_cons.sql
-rw-r--r-- 1 root root    477 Sep 14  2014 load.sh
-rw-r--r-- 1 root root    851 Sep 14  2014 README
drwxr-xr-x 2 root root   4096 Sep 14  2014 schema2
drwxr-xr-x 5 root root   4096 Sep 14  2014 scripts
drwxr-xr-x 2 root root   4096 Sep  5 23:55 src
-rwxr-xr-x 1 root root  64463 Sep  5 23:55 tpcc_load
-rwxr-xr-x 1 root root 165942 Sep  5 23:55 tpcc_start
[root@vm-test1 tpcc-mysql]# 
新建数据库
[root@vm-test1 tpcc-mysql]# mysqladmin -uroot -p123456 -S /tmp/mysql3306.sock create scutech-tpcc
新建表
mysql -uroot -p123456 -S /tmp/mysql3306.sock scutech-tpcc < create_table.sql
新建索引和FK
mysql -uroot -p123456 -S /tmp/mysql3306.sock scutech-tpcc < add_fkey_idx.sql
导入数据
./tpcc_load 127.0.0.1:3306  scutech-tpcc root 123456 1


127.0.0.1:3306 : 指定mysql的IP和端口号
scutech-tpcc : 指定数据库的名字
root : 用户名
password : 密码
10 : 仓库数(可根据需要来设置仓库数的大小,总结网上资料所说,设置40-100个是对CPU的测试,400-1000个是对IO的测试)
导入的时间可能会比较长,10个仓库刚导入进去的大小约为1G,所以应该根据实际情况来设置仓库的大小。


开始测试


./tpcc_start -h127.0.0.1 -P3306 -dscutech-tpcc -uroot -p123456 -w1 -c2 -r60 -l100


真实测试场景中,建议预热时间不小于5分钟,持续压测时长不小于30分钟,否则测试数据可能不具参考意义。
-h:指定mysql的IP
-P:指定mysql的端口号
-d:指定数据库的名字,应该和上面创建的保持一致
-u:mysql用户名
-p:mysql 用户的密码
-w:指定仓库数
-c:指定并发连接数。
-r:指定预热的时间,目的是把数据缓存到内存中
-l:指的测试时间,以10秒为间隔输出事务的吞吐量


[root@vm-test1 tpcc-mysql]# ./tpcc_start -h127.0.0.1 -P3306 -dscutech-tpcc -uroot -p123456 -w1 -c2 -r60 -l100
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '127.0.0.1'
option P with value '3306'
option d with value 'scutech-tpcc'
option u with value 'root'
option p with value '123456'
option w with value '1'
option c with value '2'
option r with value '60'     -- 数据预热时长
option l with value '100'    -- 压测时长
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: scutech-tpcc
       [user]: root
       [pass]: 123456
  [warehouse]: 1
 [connection]: 2
     [rampup]: 60 (sec.)
    [measure]: 100 (sec.)


RAMP-UP TIME.(60 sec.)


MEASURING START.  -- 预热结束,开始进行压测
-- 每10秒钟输出一次压测数据
  10, 987(63):7.357|29.188, 987(0):1.627|19.737, 98(0):1.264|1.926, 99(0):9.163|34.680, 99(2):19.999|40.131
  20, 832(70):7.956|19.530, 833(0):1.524|3.232, 84(0):0.667|0.686, 84(0):7.656|10.490, 84(1):18.958|22.736
  30, 922(148):7.653|11.707, 922(0):1.686|3.637, 91(0):0.542|0.584, 92(0):11.288|15.454, 92(0):17.745|19.431
  40, 971(96):7.926|15.102, 970(0):1.431|4.141, 98(0):0.872|1.957, 97(0):7.769|14.113, 97(1):18.923|31.487
  50, 981(86):7.804|26.649, 984(2):1.995|14.383, 98(0):0.892|1.378, 97(0):8.178|9.303, 98(1):17.964|26.095
  60, 975(112):7.448|12.658, 974(0):1.750|3.083, 97(0):0.832|0.984, 98(0):11.141|11.792, 97(1):18.073|22.017
  70, 1015(80):6.622|8.629, 1012(0):1.462|4.226, 101(0):0.558|0.628, 101(0):7.814|10.795, 101(0):16.462|19.919
  80, 987(69):6.512|10.768, 991(1):1.740|7.533, 100(0):0.664|0.721, 99(0):8.745|9.259, 99(3):19.999|44.654
  90, 993(92):7.007|15.407, 990(1):1.421|7.107, 99(0):0.614|0.682, 99(0):7.666|8.961, 100(2):19.999|26.026
 100, 956(88):6.825|28.567, 958(1):1.672|6.566, 95(0):1.200|1.540, 96(0):7.895|8.553, 95(1):19.841|47.468
-- 以逗号分隔,共6列
-- 第一列,第N次10秒
-- 第二列,新订单成功执行压测的次数(推迟执行压测的次数):90%事务的响应时间|本轮测试最大响应时间,新订单事务数也被认为是总有效事务数的指标
-- 第三列,支付业务成功执行次数(推迟执行次数):90%事务的响应时间|本轮测试最大响应时间
-- 第四列,订单状态业务的结果,后面几个的意义同上
-- 第五列,物流发货业务的结果,后面几个的意义同上
-- 第六列,库存仓储业务的结果,后面几个的意义同上


STOPPING THREADS..  -- 压测结束


<Raw Results>
  [0] sc:8716  lt:904  rt:0  fl:0 
  [1] sc:9616  lt:5  rt:0  fl:0 
  [2] sc:961  lt:0  rt:0  fl:0 
  [3] sc:962  lt:0  rt:0  fl:0 
  [4] sc:950  lt:12  rt:0  fl:0 
 in 100 sec.
 -- 第一次结果统计说明
  [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,库存业务统计,其他同上


<Raw Results2(sum ver.)>
  [0] sc:8716  lt:904  rt:0  fl:0 
  [1] sc:9616  lt:5  rt:0  fl:0 
  [2] sc:961  lt:0  rt:0  fl:0 
  [3] sc:962  lt:0  rt:0  fl:0 
  [4] sc:950  lt:12  rt:0  fl:0 


<Constraint Check> (all must be [OK])
 [transaction percentage]
        Payment: 43.48% (>=43.0%) [OK]
   Order-Status: 4.34% (>= 4.0%) [OK]
       Delivery: 4.35% (>= 4.0%) [OK]
    Stock-Level: 4.35% (>= 4.0%) [OK]
 [response time (at least 90% passed)]
      New-Order: 90.60%  [OK]
        Payment: 99.95%  [OK]
   Order-Status: 100.00%  [OK]
       Delivery: 100.00%  [OK]
    Stock-Level: 98.75%  [OK]
说明:
(all must be [OK])       -- 下面所有业务逻辑结果都必须为 OK 才行
 [transaction percentage]
        Payment: 43.47% (>=43.0%)[OK]      -- 支付成功次数(上述统计结果中 sc + lt)必须大于43.0%,否则结果为NG,而不是OK
   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%通过才行
      New-Order: 100.00%  [OK]              -- 下面几个响应耗时指标全部 100% 通过
<TpmC>
                 5772.000 TpmC      -- TpmC结果值(每分钟事务数,该值是第一次统计结果中的新订单事务数除以总耗时分钟数)
[root@vm-test1 tpcc-mysql]# 


如果在执行测试的时候,把输出的数据重定向到一个文件当中,则可以利用下面的脚本去把时间和总的事务数提取出来。
./tpcc-output-analyze.sh Log_file_name
原创粉丝点击