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

相关推荐
vvvae123428 分钟前
分布式数据库
数据库
雪域迷影1 小时前
PostgreSQL Docker Error – 5432: 地址已被占用
数据库·docker·postgresql
bug菌¹2 小时前
滚雪球学Oracle[4.2讲]:PL/SQL基础语法
数据库·oracle
逸巽散人2 小时前
SQL基础教程
数据库·sql·oracle
月空MoonSky2 小时前
Oracle中TRUNC()函数详解
数据库·sql·oracle
momo小菜pa2 小时前
【MySQL 06】表的增删查改
数据库·mysql
向上的车轮3 小时前
Django学习笔记二:数据库操作详解
数据库·django
编程老船长3 小时前
第26章 Java操作Mongodb实现数据持久化
数据库·后端·mongodb
全栈师4 小时前
SQL Server中关于个性化需求批量删除表的做法
数据库·oracle
Data 3174 小时前
Hive数仓操作(十七)
大数据·数据库·数据仓库·hive·hadoop