TPCC MySQL

目录

[1. tpcc-mysql下载](#1. tpcc-mysql下载)

[2. tpcc-mysql安装](#2. tpcc-mysql安装)

[3. 初始化tpcc-mysql](#3. 初始化tpcc-mysql)

[4. 使用tpcc-mysql测试](#4. 使用tpcc-mysql测试)

[5. 结果解释](#5. 结果解释)


1. tpcc-mysql下载

复制代码
https://github.com/Percona-Lab/tpcc-mysql

2. tpcc-mysql安装

复制代码
[root@localhost soft]# unzip tpcc-mysql-master.zip
[root@localhost soft]# cd tpcc-mysql-master
[root@localhost tpcc-mysql-master]# cd src
[root@localhost src]# make
cc -w -O3 -g -I. `mysql_config --include`  -c load.c
cc -w -O3 -g -I. `mysql_config --include`  -c support.c
cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load
cc -w -O3 -g -I. `mysql_config --include`  -c main.c
cc -w -O3 -g -I. `mysql_config --include`  -c spt_proc.c
cc -w -O3 -g -I. `mysql_config --include`  -c driver.c
cc -w -O3 -g -I. `mysql_config --include`  -c sequence.c
cc -w -O3 -g -I. `mysql_config --include`  -c rthist.c
cc -w -O3 -g -I. `mysql_config --include`  -c sb_percentile.c
cc -w -O3 -g -I. `mysql_config --include`  -c neword.c
cc -w -O3 -g -I. `mysql_config --include`  -c payment.c
cc -w -O3 -g -I. `mysql_config --include`  -c ordstat.c
cc -w -O3 -g -I. `mysql_config --include`  -c delivery.c
cc -w -O3 -g -I. `mysql_config --include`  -c slev.c
cc main.o spt_proc.o driver.o support.o sequence.o rthist.o sb_percentile.o neword.o payment.o ordstat.o delivery.o slev.o `mysql_config --libs_r` -lrt -o ../tpcc_start

3. 初始化tpcc-mysql

复制代码
[root@localhost tpcc-mysql-master]# mysql tpcc1000 < create_table.sql -uroot -p123456
[root@localhost tpcc-mysql-master]# mysql tpcc1000 < add_fkey_idx.sql -uroot -p123456
#-w 2的意思是创建2个仓库(warehouse),这个步骤需要几分钟
[root@localhost tpcc-mysql-master]# ./tpcc_load -h 127.0.0.1 -d tpcc1000 -u root -p 123456 -w 2

4. 使用tpcc-mysql测试

复制代码
#-c4表示4个线程,-r10表示预热10秒,-l30表示测试30秒,-i可以修改结果输出间隔时间默认10秒
[root@localhost tpcc-mysql-master]# ./tpcc_start -h127.0.0.1 -P3306 -dtpcc1000 -uroot -p123456 -w2 -c4 -r10 -l30
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option h with value '127.0.0.1'
option P with value '3306'
option d with value 'tpcc1000'
option u with value 'root'
option p with value '123456'
option w with value '2'
option c with value '4'
option r with value '10'
option l with value '30'
<Parameters>
     [server]: 127.0.0.1
     [port]: 3306
     [DBname]: tpcc1000
       [user]: root
       [pass]: 123456
  [warehouse]: 2
 [connection]: 4
     [rampup]: 10 (sec.)
    [measure]: 30 (sec.)

RAMP-UP TIME.(10 sec.)

MEASURING START.

  10, trx: 191, 95%: 454.450, 99%: 1613.066, max_rt: 2582.587, 189|843.871, 19|45.994, 19|2829.055, 19|743.433
  20, trx: 334, 95%: 135.242, 99%: 271.328, max_rt: 326.776, 336|442.681, 33|47.831, 33|560.610, 33|630.436
  30, trx: 465, 95%: 105.395, 99%: 218.395, max_rt: 370.466, 464|304.463, 47|23.368, 47|572.535, 46|304.000

STOPPING THREADS....

<Raw Results>
  [0] sc:0 lt:990  rt:0  fl:0 avg_rt: 81.9 (5)
  [1] sc:97 lt:892  rt:0  fl:0 avg_rt: 28.1 (5)
  [2] sc:78 lt:21  rt:0  fl:0 avg_rt: 7.4 (5)
  [3] sc:24 lt:75  rt:0  fl:0 avg_rt: 205.9 (80)
  [4] sc:0 lt:98  rt:0  fl:0 avg_rt: 198.2 (20)
 in 30 sec.

<Raw Results2(sum ver.)>
  [0] sc:0  lt:990  rt:0  fl:0 
  [1] sc:97  lt:892  rt:0  fl:0 
  [2] sc:78  lt:21  rt:0  fl:0 
  [3] sc:24  lt:75  rt:0  fl:0 
  [4] sc:0  lt:98  rt:0  fl:0 

<Constraint Check> (all must be [OK])
 [transaction percentage]
        Payment: 43.47% (>=43.0%) [OK]
   Order-Status: 4.35% (>= 4.0%) [OK]
       Delivery: 4.35% (>= 4.0%) [OK]
    Stock-Level: 4.31% (>= 4.0%) [OK]
 [response time (at least 90% passed)]
      New-Order: 0.00%  [NG] *
        Payment: 9.81%  [NG] *
   Order-Status: 78.79%  [NG] *
       Delivery: 24.24%  [NG] *
    Stock-Level: 0.00%  [NG] *

<TpmC>
                 1980.000 TpmC #每分钟处理事务的总量(5个业务,支付,发货等等)

可以在./tpcc-mysql-master/src目录下查看各个业务的逻辑源码

测试的时候可以mysqladmin查看查询量更新量等等

复制代码
mysqladmin extended-status -i 1 -uroot -p123456 -r| grep -i -E "Questions|Com_select|Com_update"
......
| Com_delete                                    | 31                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Com_delete_multi                              | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Com_insert                                    | 479                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Com_insert_select                             | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Com_select                                    | 1814                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Com_update                                    | 609                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Com_update_multi                              | 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Questions                                     | 3046
......

Questions由select、insert、delete、update等组成

5. 结果解释

复制代码
  10, trx: 191, 95%: 454.450, 99%: 1613.066, max_rt: 2582.587, 189|843.871, 19|45.994, 19|2829.055, 19|743.433
  20, trx: 334, 95%: 135.242, 99%: 271.328, max_rt: 326.776, 336|442.681, 33|47.831, 33|560.610, 33|630.436
  30, trx: 465, 95%: 105.395, 99%: 218.395, max_rt: 370.466, 464|304.463, 47|23.368, 47|572.535, 46|304.000

10:测试的秒数

trx: 191-在给定的时间间隔内执行的新订单事务(在本例中为前10秒)。基本上,这是每个10秒间隔的吞吐量。越多越好

95%: 454.450-95%的新订单事务响应时间在454.450秒内

99%: 1613.066-99%的新订单事务响应时间在1613.066秒内

max_rt: 2582.587-新订单事务最大响应时间是2582.587秒

189|843.871, 19|45.994, 19|2829.055, 19|743.433-其他类型事务的吞吐量和最大响应时间,可以忽略

相关推荐
云老大TG:@yunlaoda3606 分钟前
如何使用华为云国际站代理商的FunctionGraph进行事件驱动的应用开发?
大数据·数据库·华为云·云计算
清水白石0087 分钟前
《用 Python 单例模式打造稳定高效的数据库连接管理器》
数据库·python·单例模式
小虾米vivian10 分钟前
dmetl5 web管理平台 监控-流程监控 看不到运行信息
linux·服务器·网络·数据库·达梦数据库
yuzhucu16 分钟前
django4.1.2+xadmin配置
数据库·sqlite
「光与松果」20 分钟前
MySQL中统计各个IP的连接数
数据库·mysql
骄傲的心别枯萎21 分钟前
RV1126 NO.57:ROCKX+RV1126人脸识别推流项目之读取人脸图片并把特征值保存到sqlite3数据库
数据库·opencv·计算机视觉·sqlite·音视频·rv1126
苹果醋329 分钟前
Java设计模式实战:从面向对象原则到架构设计的最佳实践
java·运维·spring boot·mysql·nginx
boy快快长大31 分钟前
【MySQL】InnoDB记录存储结构
数据库·mysql
yaoxtao32 分钟前
neo4j数据库的导入和导出
数据库
卓码软件测评35 分钟前
CMA/CNAS软件测评机构:【Gatling数据库性能关联测试JDBC连接和SQL执行时间监控】
数据库·sql·测试工具·性能优化·测试用例