达梦数据库tpcc的测试

达梦数据库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/
    
  3. 复制驱动文件到lib 下

    cp /dm8/drivers/jdbc/DmJdbcDriver18.jar 
    
  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
    
    
  5. 创建用户

    create user benchmarksql identified by "Dameng123@";
    grant dba to benchmarksql;
    
  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
            );
    
  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
    ------------------------------------------------------
    
  8. 创建索引

    create
            index ndx_customer_name on benchmarksql.customer
            (
                    c_w_id,
                    c_d_id,
                    c_last,
                    c_first
            );
    
  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;
    
  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. 开始测试

    [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,   
    ...............               
    
  2. 测试日志

    [root@oracle log]# pwd
    /root/benchmarksql-4.1.1/run/log
    [root@oracle log]# ls
    BenchmarkSQLError.log  benchmarksql.log
    

3. 总结

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

链接文章为转载

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值