mysql 测试系列2 -TPCC 模型测试 -tpcc-mysql 安装测试

来源:互联网 发布:单片机ds18b20 编辑:程序博客网 时间:2024/06/17 17:49

1:  TPCC 模型介绍

     请参考百度百科 :  http://baike.baidu.com/view/2776305.htm

2:    tpcc -mysql 的编译安装

     tpcc -mysql 的源代码下载 这里不再介绍了. 比较麻烦.

     tpcc-mysql的编译安装;  假设 mysql安装在/tmp/mysql ,tpcc-mysql 源代码在 /tmp/tpcc-mysql

      ->cd /tmp/tpcc-mysql/src

       # 设置环境变量

       ->export C_INCLUDE_PATH=/tmp/mysql/include

       ->export PATH=/tmp/mysql/bin:$PATH

       ->export LD_LIBRARY_PATH=/tmp/mysql/lib:$LD_LIBRARY_PATH

      # 编译安装

     -> make

      #make 之后在 /tmp/tpcc-mysql/下就会多出两个脚本 tpcc_load , tpcc_start

3:  创建测试数据库,并导入数据

     # 创建mysql 数据库

     ->mysql -uroot -h127.0.0.1

         show databases;

        create database tpcc_test;

       show databases;

      exit;

     #创建表

     ->mysql -uroot -h127.0.0.1 tpcc_test<create_table.sql 

     ->mysql -uroot -h127.0.0.1

        use tpcc_test;

       show tables;

    # 创建索引

   -> mysql -uroot tpcc_test < add_fkey_idx.sql

    # 导入数据

  -> ./tpcc_load 127.0.0.1:3306 tpcc_test root "" 1

      # tpcc_test : 表命 .  root :用户名   ""密码   1: 表示1个warehouse

       # 格式:  tpcc_load [server] [DB] [user] [pass] [warehouse]

4 开始压测: 

   ->./tpcc_start -h 127.0.0.1 -d tpcc_test -u root -w 1 -c 16 -r 10 -l 20 >>/tmp/result.txt

     # 常见的压测参数介绍

     #命令格式:  tpcc_start -h server_host -P port -d database_name -u mysql_user -p mysql_password -w warehouses -c connections -r warmup_time -l running_time -i report_interval -f report_file

    #-w warehouses: 数据仓库数量   

   #-r warmup_time :将数据加入缓存的诗句

   #-c connections : 连接数

   # -l running_time: 运行时间

5: 测试结果分析

   主要关注参数是否达标和 tpmc 的数值

    <Constraint Check> (all must be [OK])
       [transaction percentage]
        Payment: 41.22% (>=43.0%) [NG] *
   Order-Status: 4.51% (>= 4.0%) [OK]
       Delivery: 4.51% (>= 4.0%) [OK]
    Stock-Level: 4.51% (>= 4.0%) [OK]
 [response time (at least 90% passed)]
      New-Order: 99.62%  [OK]
        Payment: 100.00%  [OK]
   Order-Status: 100.00%  [OK]
       Delivery: 100.00%  [OK]
    Stock-Level: 99.04%  [OK]

<TpmC>
                 3132.000 TpmC

payment:  没有达标

tpmc:  一分钟3132.000 次事物.

0 0
原创粉丝点击