zoukankan      html  css  js  c++  java
  • 压力测试之TCPP

    1.下载源码 tpcc-mysql-src.tgz

    2.解压 tpcc-mysql-src.tgz

    3.安装

    [root@DBMysql mysql]# cd /home/mysql/tpcc-mysql/src
    [root@DBMysql src]# export PATH=/usr/local/mysql/bin:$PATH
    [root@DBMysql 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
    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@DBMysql src]#

    4.创建数据库导入预定脚本

    [mysql@DBMysql tpcc-mysql]$ mysqladmin --defaults-file=/data/mysqldata/my.cnf -uroot -p123456 -P3306 -h192.168.0.45 create tpcc
    Warning: Using a password on the command line interface can be insecure.
    [mysql@DBMysql tpcc-mysql]$ mysql --defaults-file=/data/mysqldata/my.cnf -uroot -p123456 -P3306 -h192.168.0.45
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    | tpcc               |
    +--------------------+
    mysql>
    
    导入预定脚本:
    mysql> use tpcc
    Database changed
    mysql> show variables like '%storage_engine%';
    +----------------------------+--------+
    | Variable_name              | Value  |
    +----------------------------+--------+
    | default_storage_engine     | InnoDB |
    | default_tmp_storage_engine | InnoDB |
    | storage_engine             | InnoDB |
    +----------------------------+--------+
    3 rows in set (0.10 sec)
    
    mysql> source /home/mysql/tpcc-mysql/create_table.sql  #注意脚本的执行权限
    mysql> source /home/mysql/tpcc-mysql/add_fkey_idx.sql

    5.初始化数据(不用指定端口号)

    [mysql@DBMysql tpcc-mysql]$ ./tpcc_load 192.168.0.45 tpcc root 123456 10
    *************************************
    *** ###easy### TPC-C Data Loader  ***
    *************************************
    <Parameters>
         [server]: 192.168.0.45
         [port]: 3306
         [DBname]: tpcc
           [user]: root
           [pass]: 123456
      [warehouse]: 10
    TPCC Data Load Started...
    Loading Item 
    .................................................. 5000
    .................................................. 10000
    .................................................. 15000
    .................................................. 20000
    很长很长世间
    Orders Done.
    Loading Orders for D=10, W= 10
    .......... 1000
    .......... 2000
    .......... 3000
    Orders Done.
    
    ...DATA LOADING COMPLETED SUCCESSFULLY.
    [mysql@DBMysql tpcc-mysql]$ 

    6.进行测试

    [mysql@DBMysql tpcc-mysql]$ ./tpcc_start --help
    ***************************************
    *** ###easy### TPC-C Load Generator ***
    ***************************************
    ./tpcc_start: invalid option -- -
    Usage: 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 -t trx_file
    [mysql@DBMysql tpcc-mysql]$ ./tpcc_start -h 192.168.0.45 -P 3306 -d tpcc -u root -p 123456 -w 10 -c 10 -r 100 -l 300 -f /home/mysql/tpcc-mysql.log -t /home/mysql/tpcc_mysql.rtx

    --参数介绍
    -w warehouses     --仓库数量
    -c connections    --连接数量
    -r warmup_time    --指定预热时间,默认10秒,主要目的是将数据加载到内存
    -l running_time   --指定测试执行时间
    -i report_interval --指定生成报告的间隔时间
    -f report_file     --将测试中各项操作的记录输出到指定的文件中
    -t trx_file        --输出更详细的操作信息到指定的文件中
  • 相关阅读:
    phpstorm 2016.3.2 的最新破解方法(截止2017-2-20)
    在GitHub多个帐号上添加SSH公钥
    mac laravel 环境变量设置bash_profile
    Laravel的三种安装方法总结
    laravel登录后台500错误!
    composer镜像安装laravel
    phpstorm 代码按列对齐
    .DS_Store 文件是什么?Mac下面如何禁止.DS_Store生成
    如何在Mac下显示Finder中的所有文件
    PHP_环境配置_python脚本_2017
  • 原文地址:https://www.cnblogs.com/polestar/p/5638815.html
Copyright © 2011-2022 走看看