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-其他类型事务的吞吐量和最大响应时间,可以忽略

相关推荐
忧郁的蛋~1 小时前
EFcore查询a表中符合b表列的值
数据库
xwz小王子1 小时前
ManipulationNet:开启真实世界机器人操作基准测试新时代
数据库·机器人
咯哦哦哦哦1 小时前
关于QT 打印中文 乱码问题
java·数据库·qt
野犬寒鸦2 小时前
从零起步学习Redis || 第十二章:Redis Cluster集群如何解决Redis单机模式的性能瓶颈及高可用分布式部署方案详解
java·数据库·redis·后端·缓存
ShooterJ2 小时前
Mysql小表驱动大表优化原理
数据库·后端·面试
程序员三明治2 小时前
【MyBatis从入门到入土】告别JDBC原始时代:零基础MyBatis极速上手指南
数据库·mysql·mybatis·jdbc·数据持久化·数据
cookqq2 小时前
MongoDB源码delete分析oplog:从删除链路到核心函数实现
数据结构·数据库·sql·mongodb·nosql
知其然亦知其所以然2 小时前
面试官一开口就问:“你了解MySQL水平分区吗?”我当场差点懵了……
后端·mysql·面试
咖啡Beans2 小时前
MySQL的JSON_函数总结
mysql
神仙别闹3 小时前
基于Java(Spring Boot)+MySQL实现电商网站
java·spring boot·mysql