当前位置:   article > 正文

达梦数据库tpcc的测试_tpccrunner 的测试结果不准确

tpccrunner 的测试结果不准确

达梦数据库tpcc的测试

1.tpcc简介

  • 事务处理性能委员会( Transaction Processing Performance Council ),简称TPC,它的功能是制定商务应用基准程序(Benchmark)的标准规范、性能和价格度量,并管理测试结果的发布。
  • TPC-C是在线事务处理(OLTP)的基准程序,用于衡量数据库系统OLTP性能的指标。

2.测试软件的按章

  1. 下载软件
    benchmarksql-5.0.zip

  2. 解压

    unzip benchmarksql-4.1.1.zip /root/benchmarksql-4.1.1/lib/
    
    • 1
  3. 复制驱动文件到lib 下

    cp /dm8/drivers/jdbc/DmJdbcDriver18.jar 
    
    • 1
  4. 编辑配置文件

    [root@oracle run]# pwd
    /root/benchmarksql-4.1.1/run
    [root@oracle run]# cat props.dm 
    driver=dm.jdbc.driver.DmDriver
    conn=jdbc:dm://localhost:8881
    user=benchmarksql
    password=Dameng123@
    
    warehouses=2
    terminals=1
    //To run specified transactions per terminal- runMins must equal zero
    runTxnsPerTerminal=0
    //To run for specified minutes- runTxnsPerTerminal must equal zero
    runMins=5
    //Number of total transactions per minute
    limitTxnsPerMin=0
    
    //The following five values must add up to 100
    newOrderWeight=45
    paymentWeight=43
    orderStatusWeight=4
    deliveryWeight=4
    stockLevelWeight=4
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
  5. 创建用户

    create user benchmarksql identified by "Dameng123@";
    grant dba to benchmarksql;
    
    • 1
    • 2
  6. 创建测试用得表

    create
            table benchmarksql.warehouse
            (
                    w_id int not null ,
                    w_ytd float       ,
                    w_tax float       ,
                    w_name     varchar(10),
                    w_street_1 varchar(20),
                    w_street_2 varchar(20),
                    w_city     varchar(20),
                    w_state    char(2)    ,
                    w_zip      char(9)    ,
                    cluster primary key(w_id)
            )
            storage
            (
                    fillfactor 2,
                    without counter
            );
    
    create
            table benchmarksql.district
            (
                    d_w_id int not null    ,
                    d_id   int not null    ,
                    d_ytd float            ,
                    d_tax float            ,
                    d_next_o_id int        ,
                    d_name      varchar(10),
                    d_street_1  varchar(20),
                    d_street_2  varchar(20),
                    d_city      varchar(20),
                    d_state     char(2)    ,
                    d_zip       char(9)    ,
                    cluster primary key(d_w_id, d_id)
            )
            storage
            (
                    fillfactor 3,
                    without counter
            );
    
    create
            table benchmarksql.customer
            (
                    c_w_id int not null       ,
                    c_d_id int not null       ,
                    c_id   int not null       ,
                    c_discount float          ,
                    c_credit char(2)          ,
                    c_last   varchar(16)      ,
                    c_first  varchar(16)      ,
                    c_credit_lim float        ,
                    c_balance float           ,
                    c_ytd_payment float       ,
                    c_payment_cnt  int        ,
                    c_delivery_cnt int        ,
                    c_street_1     varchar(20),
                    c_street_2     varchar(20),
                    c_city         varchar(20),
                    c_state        char(2)    ,
                    c_zip          char(9)    ,
                    c_phone        char(16)   ,
                    c_since timestamp         ,
                    c_middle char(2)          ,
                    c_data   varchar(500)     ,
                    cluster primary key(c_w_id, c_d_id, c_id)
            )
            storage
            (
                    without counter
            );
    
    create sequence benchmarksql.hist_id_seq;
    
    
    create
            table benchmarksql.history
            (
                    hist_id  int default benchmarksql.hist_id_seq.NEXTVAL,
                    h_c_id   int                                         ,
                    h_c_d_id int                                         ,
                    h_c_w_id int                                         ,
                    h_d_id   int                                         ,
                    h_w_id   int                                         ,
                    h_date timestamp                                     ,
                    h_amount float                                       ,
                    h_data varchar(24)
            )
            storage
            (
                    branch(16, 16),
                    without counter
            );
    
    create
            table benchmarksql.oorder
            (
                    o_w_id       int not null,
                    o_d_id       int not null,
                    o_id         int not null,
                    o_c_id       int         ,
                    o_carrier_id int         ,
                    o_ol_cnt float           ,
                    o_all_local float        ,
                    o_entry_d timestamp      ,
                    cluster primary key(o_w_id, o_d_id, o_id)
            )
            storage
            (
                    without counter
            );
    
    
    create
            table benchmarksql.new_order
            (
                    no_w_id int not null,
                    no_d_id int not null,
                    no_o_id int not null,
                    cluster primary key(no_w_id, no_d_id, no_o_id)
            )
            storage
            (
                    without counter
            );
    
    
    create
            table benchmarksql.order_line
            (
                    ol_w_id   int not null ,
                    ol_d_id   int not null ,
                    ol_o_id   int not null ,
                    ol_number int not null ,
                    ol_i_id   int not null ,
                    ol_delivery_d timestamp,
                    ol_amount float        ,
                    ol_supply_w_id int     ,
                    ol_quantity float      ,
                    ol_dist_info char(24)  ,
                    cluster primary key(ol_w_id, ol_d_id, ol_o_id, ol_number)
            )
            storage
            (
                    without counter
            );
    
    
    create
            table benchmarksql.stock
            (
                    s_w_id int not null     ,
                    s_i_id int not null     ,
                    s_quantity float        ,
                    s_ytd float             ,
                    s_order_cnt  int        ,
                    s_remote_cnt int        ,
                    s_data       varchar(50),
                    s_dist_01    char(24)   ,
                    s_dist_02    char(24)   ,
                    s_dist_03    char(24)   ,
                    s_dist_04    char(24)   ,
                    s_dist_05    char(24)   ,
                    s_dist_06    char(24)   ,
                    s_dist_07    char(24)   ,
                    s_dist_08    char(24)   ,
                    s_dist_09    char(24)   ,
                    s_dist_10    char(24)   ,
                    cluster primary key(s_i_id, s_w_id)
            )
            storage
            (
                    without counter
            );
    
    
    create
            table benchmarksql.item
            (
                    i_id   int not null,
                    i_name varchar(24) ,
                    i_price float      ,
                    i_data  varchar(50) ,
                    i_im_id int         ,
                    cluster primary key(i_id)
            )
            storage
            (
                    without counter
            );
    
    
    
    
    create
            index ndx_customer_name on benchmarksql.customer
            (
                    c_w_id,
                    c_d_id,
                    c_last,
                    c_first
            );
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
  7. 装载数据

    [root@oracle run]# pwd
    /root/benchmarksql-4.1.1/run
    [root@oracle run]# ./runLoader.sh props.dm numWAREHOUSES 1
    Starting BenchmarkSQL LoadData
    ----------------- Initialization -------------------
    numWAREHOUSES
    1
    driver=dm.jdbc.driver.DmDriver
    conn=jdbc:dm://localhost:8881
    user=benchmarksql
    password=******
    
    ------------- LoadData StartTime = Thu Nov 19 16:57:02 CST 2020-------------
    ..................
    ..................
    
    ------------- LoadJDBC Statistics --------------------
         Start Time = Thu Nov 19 16:57:02 CST 2020
           End Time = Thu Nov 19 16:57:04 CST 2020
           Run Time = 1 Seconds
        Rows Loaded = 40002 Rows
    Rows Per Second = 40002 Rows/Sec
    ------------------------------------------------------
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
  8. 创建索引

    create
            index ndx_customer_name on benchmarksql.customer
            (
                    c_w_id,
                    c_d_id,
                    c_last,
                    c_first
            );
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
  9. 创建存储过程

    create or replace
    procedure benchmarksql.createsequence
    as
            n    int;
            stmt varchar(100);
    begin
            stmt:='drop sequence benchmarksql.hist_id_seq';
            EXECUTE IMMEDIATE stmt;
            select max(hist_id) + 1 into n from benchmarksql.history ;
            
            stmt:='create sequence benchmarksql.hist_id_seq start with '||n;
            EXECUTE IMMEDIATE stmt;
    end;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
  10. 预热数据让测试更加准确

	select count(*) from "BENCHMARKSQL"."CUSTOMER"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."DISTRICT"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."ITEM"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."NEW_ORDER"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."OORDER"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."ORDER_LINE"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."STOCK"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."WAREHOUSE"
		
		union all
		
		select count(*) from "BENCHMARKSQL"."HISTORY"
		
		union all
		
		select count("C_PAYMENT_CNT") from "BENCHMARKSQL"."CUSTOMER";
		commit;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  1. 开始测试

    [root@oracle run]# ./runBenchmark.sh props.dm 
    2020-11-19 17:01:40,369  INFO - Term-00, 
    2020-11-19 17:01:40,369  INFO - Term-00, +-------------------------------------------------------------+
    2020-11-19 17:01:40,369  INFO - Term-00,      BenchmarkSQL v4.1.1
    2020-11-19 17:01:40,370  INFO - Term-00, +-------------------------------------------------------------+
    2020-11-19 17:01:40,370  INFO - Term-00,  (c) 2003, Raul Barbosa
    2020-11-19 17:01:40,370  INFO - Term-00,  (c) 2004-2016, Denis Lussier
    2020-11-19 17:01:40,370  INFO - Term-00,  (c) 2016, Jan Wieck
    2020-11-19 17:01:40,370  INFO - Term-00, +-------------------------------------------------------------+
    2020-11-19 17:01:40,370  INFO - Term-00, 
    2020-11-19 17:01:40,370  INFO - Term-00, driver=dm.jdbc.driver.DmDriver
    2020-11-19 17:01:40,370  INFO - Term-00, conn=jdbc:dm://localhost:8881
    2020-11-19 17:01:40,370  INFO - Term-00, user=benchmarksql
    2020-11-19 17:01:40,370  INFO - Term-00, 
    2020-11-19 17:01:40,370  INFO - Term-00, warehouses=2
    2020-11-19 17:01:40,371  INFO - Term-00, terminals=1
    2020-11-19 17:01:40,371  INFO - Term-00, runMins=5
    2020-11-19 17:01:40,371  INFO - Term-00, limitTxnsPerMin=0
    2020-11-19 17:01:40,371  INFO - Term-00, 
    2020-11-19 17:01:40,371  INFO - Term-00, newOrderWeight=45
    2020-11-19 17:01:40,371  INFO - Term-00, paymentWeight=43
    2020-11-19 17:01:40,371  INFO - Term-00, orderStatusWeight=4
    2020-11-19 17:01:40,371  INFO - Term-00, deliveryWeight=4
    2020-11-19 17:01:40,371  INFO - Term-00, stockLevelWeight=4
    2020-11-19 17:01:40,371  INFO - Term-00,   
    ...............               
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
  2. 测试日志

    [root@oracle log]# pwd
    /root/benchmarksql-4.1.1/run/log
    [root@oracle log]# ls
    BenchmarkSQLError.log  benchmarksql.log
    
    • 1
    • 2
    • 3
    • 4

3. 总结

本文章是简单配置一下进行数据库得测试。如果想要更加了解benchmarksql,请参考benchmarksql简介

链接文章为转载

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/935570
推荐阅读
相关标签
  

闽ICP备14008679号