tppc_mysql基准测试性能分析工具

改工具安装比较简单!、

获取源码:
yum install bzr
bzr branch lp:~percona-dev/perconatools/tpcc-mysql

进入src目录可以进行make命令安装完成即可,但是由于我mysql相关的环境发生变化发生如下错误;如;

[root@slave01 src]# make
cc -w -O2 -g -I. `mysql_config --include`  -c load.c
load.c:18:19: error: mysql.h: No such file or directory
In file included from load.c:20:
spt_proc.h:1: error: expected ??before ??token
load.c:26: error: expected ?? ?? ?? 鈇sm?or 鈅_attribute__?before ??token
load.c:27: error: expected ?? ?? ?? 鈇sm?or 鈅_attribute__?before ??token
load.c:49: error: expected ??before ??token
load.c: In function 鈓ain?
load.c:80: error: 釳YSQL?undeclared (first use in this function)
load.c:80: error: (Each undeclared identifier is reported only once
load.c:80: error: for each function it appears in.)
load.c:80: error: 鈘esp?undeclared (first use in this function)
load.c:183: error: 鈓ysql?undeclared (first use in this function)
load.c:203: error: 鈙tmt?undeclared (first use in this function)
load.c: In function 釲oadItems?
load.c:312: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:312: error: expected ??before 鈖aram?
load.c:366: error: 鈖aram?undeclared (first use in this function)
load.c:367: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:371: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:374: error: 釳YSQL_TYPE_FLOAT?undeclared (first use in this function)
load.c:379: error: 鈙tmt?undeclared (first use in this function)
load.c:397: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釲oadWare?
load.c:428: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:428: error: expected ??before 鈖aram?
load.c:459: error: 鈖aram?undeclared (first use in this function)
load.c:460: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:462: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:480: error: 釳YSQL_TYPE_FLOAT?undeclared (first use in this function)
load.c:484: error: 鈙tmt?undeclared (first use in this function)
load.c:492: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釲oadCust?
load.c:521: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釲oadOrd?
load.c:550: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釹tock?
load.c:590: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:590: error: expected ??before 鈖aram?
load.c:644: error: 鈖aram?undeclared (first use in this function)
load.c:645: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:651: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:684: error: 鈙tmt?undeclared (first use in this function)
load.c: In function 釪istrict?
load.c:732: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:732: error: expected ??before 鈖aram?
load.c:756: error: 鈖aram?undeclared (first use in this function)
load.c:757: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:761: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:779: error: 釳YSQL_TYPE_FLOAT?undeclared (first use in this function)
load.c:785: error: 鈙tmt?undeclared (first use in this function)
load.c: In function 釩ustomer?
load.c:838: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:838: error: expected ??before 鈖aram?
load.c:892: error: 鈖aram?undeclared (first use in this function)
load.c:893: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:899: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:934: error: 釳YSQL_TYPE_FLOAT?undeclared (first use in this function)
load.c:941: error: 鈙tmt?undeclared (first use in this function)
load.c:987: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釵rders?
load.c:1024: error: 釳YSQL_BIND?undeclared (first use in this function)
load.c:1024: error: expected ??before 鈖aram?
load.c:1051: error: 鈖aram?undeclared (first use in this function)
load.c:1052: error: 釳YSQL_TYPE_LONG?undeclared (first use in this function)
load.c:1060: error: 釳YSQL_TYPE_STRING?undeclared (first use in this function)
load.c:1065: error: 鈙tmt?undeclared (first use in this function)
load.c:1148: error: 釳YSQL_TYPE_FLOAT?undeclared (first use in this function)
load.c:1205: error: 鈓ysql?undeclared (first use in this function)
load.c: In function 釫rror?
load.c:1242: error: expected declaration specifiers before 釳YSQL_STMT?
load.c:1248: error: 鈓ysql?undeclared (first use in this function)
make: *** [load.o] Error 1
[root@slave01 src]# 

[root@slave01 src]# export C_INCLUDE_PATH=/usr/local/mysql/include/
[root@slave01 src]# make
cc -w -O2 -g -I. `mysql_config --include`  -c load.c
cc -w -O2 -g -I. `mysql_config --include`  -c support.c
cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [../tpcc_load] Error 1
[root@slave01 src]# export LD_LIBRARY_PATH=/usr/local/mysql/lib
[root@slave01 src]# make
cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [../tpcc_load] Error 1
[root@slave01 src]#

这里设置化境变量设置后还是同样报错误信息,说是没有找到相关的mysqlclinet。这里需要设置这三个变量就可完成:如:

1.找不到mysql的头文件。
解决:export C_INCLUDE_PATH=$MYSQL_HOME/include
2.找不到mysql_config程序
解决:export PATH=$MYSQL_HOME/bin:$PATH
3.运行时找不到mysql库
解决:export LD_LIBRARY_PATH=$MYSQL_HOME/lib

然后入库创建数据库名,执行相关的createsql即可如:下:

[root@slave01 src]# export  C_INCLUDE_PATH=/usr/local/mysql/include
[root@slave01 src]# export PATH=/usr/local/mysql/bin:$PATH
[root@slave01 src]# export LD_LIBRARY_PATH=/usr/local/mysql/lib
[root@slave01 src]# make
cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load
cc -w -O2 -g -I. `mysql_config --include`  -c main.c
cc -w -O2 -g -I. `mysql_config --include`  -c spt_proc.c
cc -w -O2 -g -I. `mysql_config --include`  -c driver.c
cc -w -O2 -g -I. `mysql_config --include`  -c sequence.c
cc -w -O2 -g -I. `mysql_config --include`  -c rthist.c
cc -w -O2 -g -I. `mysql_config --include`  -c neword.c
cc -w -O2 -g -I. `mysql_config --include`  -c payment.c
cc -w -O2 -g -I. `mysql_config --include`  -c ordstat.c
cc -w -O2 -g -I. `mysql_config --include`  -c delivery.c
cc -w -O2 -g -I. `mysql_config --include`  -c slev.c
cc main.o spt_proc.o driver.o support.o sequence.o rthist.o neword.o payment.o ordstat.o delivery.o slev.o `mysql_config --libs_r` -lrt -o ../tpcc_start
[root@slave01 src]# cd ..
[root@slave01 tpcc-mysql]# ls
add_fkey_idx.sql  create_table.sql  load.sh  schema2  src        tpcc_start
count.sql         drop_cons.sql     README   scripts  tpcc_load
[root@slave01 tpcc-mysql]# mysql tpc300 < create_table.sql 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@slave01 tpcc-mysql]# mysql -uroot -proot  tpc300 < create_table.sql 
ERROR 1049 (42000): Unknown database 'tpc300'
[root@slave01 tpcc-mysql]# mysql -uroot -proot  tpcc300 < create_table.sql 
[root@slave01 tpcc-mysql]# ls
add_fkey_idx.sql  create_table.sql  load.sh  schema2  src        tpcc_start
count.sql         drop_cons.sql     README   scripts  tpcc_load

测试通过,然后进行使用该工具即可;如:

[root@slave01 tpcc-mysql]# ./tpcc_load 192.168.0.42 tpcc300 root root 300
*************************************
*** ###easy### TPC-C Data Loader  ***
*************************************
<Parameters>
     [server]: 192.168.0.42
     [port]: 3306
     [DBname]: tpcc300
       [user]: root
       [pass]: root
  [warehouse]: 300
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=4

[root@slave01 tpcc-mysql]# ./tpcc_start 192.168.0.42 -d tpcc100 -uroot -proot 100 16 600 1200
***************************************
*** ###easy### TPC-C Load Generator ***
***************************************
option d with value 'tpcc100'
option u with value 'root'
option p with value 'root'
non-option ARGV-elements: 192.168.0.42 100 16 600 1200 
<Parameters>
     [server]: 
     [port]: 3306
     [DBname]: tpcc100
       [user]: root
       [pass]: root
  [warehouse]: 1
 [connection]: 10
     [rampup]: 10 (sec.)
    [measure]: 20 (sec.)


RAMP-UP TIME.(10 sec.)


MEASURING START.


  10, 179(0):1.817|2.092, 174(0):0.445|0.565, 17(0):0.223|0.387, 18(0):1.783|1.800, 17(0):4.857|4.857
  20, 180(0):1.746|2.045, 187(0):0.427|0.454, 19(0):0.200|0.253, 17(0):1.715|1.763, 18(0):4.276|4.952


STOPPING THREADS..........


<Raw Results>
  [0] sc:359  lt:0  rt:0  fl:0 
  [1] sc:361  lt:0  rt:0  fl:0 
  [2] sc:36  lt:0  rt:0  fl:0 
  [3] sc:35  lt:0  rt:0  fl:0 
  [4] sc:35  lt:0  rt:0  fl:0 
 in 20 sec.


<Raw Results2(sum ver.)>
  [0] sc:359  lt:0  rt:0  fl:0 
  [1] sc:361  lt:0  rt:0  fl:0 
  [2] sc:36  lt:0  rt:0  fl:0 
  [3] sc:35  lt:0  rt:0  fl:0 
  [4] sc:35  lt:0  rt:0  fl:0 


<Constraint Check> (all must be [OK])
 [transaction percentage]
        Payment: 43.70% (>=43.0%) [OK]
   Order-Status: 4.36% (>= 4.0%) [OK]
       Delivery: 4.24% (>= 4.0%) [OK]
    Stock-Level: 4.24% (>= 4.0%) [OK]
 [response time (at least 90% passed)]
      New-Order: 100.00%  [OK]
        Payment: 100.00%  [OK]
   Order-Status: 100.00%  [OK]
       Delivery: 100.00%  [OK]
    Stock-Level: 100.00%  [OK]


<TpmC>
                 1077.000 TpmC
[root@slave01 tpcc-mysql]# 

你可能感兴趣的:(tppc_mysql基准测试性能分析工具)