当前位置:   article > 正文

benchmark压测达梦数据库_达梦 benchmarksql

达梦 benchmarksql

一、安装

benchmark官网下载后解压即可,需要jdk1.8环境

说明:此文档仅作为学习使用压测工具为目的,不具有其他代表性。

二、修改配置链接达梦数据库

2.1 修改配置

第一处修改新增以下红框内容

benchmarksql-5.0/src/client/jTPCC.java

第二处修改新增以下红框内容

benchmarksql-5.0/run/funcs.sh

2.2 添加驱动修改数据库链接

在lib目录下新增dm目录拷贝驱动到此

在run目录下复制props.ora为props.dm,修改链接即可

root@178-35:/home/dmdba/benchmarksql-5.0/run# cat props.dm

db=dm  //指定目标数据库是达梦

driver=dm.jdbc.driver.DmDriver //达梦JDBC程序类

conn=jdbc:dm://127.0.0.1:5236 //数据库连接

user=SYSDBA

password=SYSDBA

warehouses=100 //设置压测使用的仓数

loadWorkers=20 //初始化数据加载线程

terminals=100 //设置测试期间模拟用户数量

//To run specified transactions per terminal- runMins must equal zero

runTxnsPerTerminal=0

//To run for specified minutes- runTxnsPerTerminal must equal zero

runMins=10

//Number of total transactions per minute

limitTxnsPerMin=0

//Set to true to run in 4.x compatible mode. Set to false to use the

//entire configured database evenly.

terminalWarehouseFixed=true

//The following five values must add up to 100

newOrderWeight=45

paymentWeight=43

orderStatusWeight=4

deliveryWeight=4

stockLevelWeight=4

// Directory name to create for collecting detailed result data.

// Comment this out to suppress.

resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS

osCollectorScript=./misc/os_collector_linux.py

osCollectorInterval=1

//osCollectorSSHAddr=user@dbhost

osCollectorDevices=net_eth0 blk_sda

2.3 使用ant重编译

三、创建表导入数据

脚本在以下目录

/home/dmdba/benchmarksql-5.0/run# ./runDatabaseBuild.sh props.dm

root@:/home/dmdba/benchmarksql-5.0/run# ./runDatabaseBuild.sh props.dm

# ------------------------------------------------------------

# Loading SQL file ./sql.common/tableCreates.sql

# ------------------------------------------------------------

create table bmsql_config (

cfg_name    varchar(30) primary key,

cfg_value   varchar(50)

);

create table bmsql_warehouse (

w_id        integer   not null,

w_ytd       decimal(12,2),

w_tax       decimal(4,4),

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)

);

create table bmsql_district (

d_w_id       integer       not null,

d_id         integer       not null,

d_ytd        decimal(12,2),

d_tax        decimal(4,4),

d_next_o_id  integer,

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)

);

create table bmsql_customer (

c_w_id         integer        not null,

c_d_id         integer        not null,

c_id           integer        not null,

c_discount     decimal(4,4),

c_credit       char(2),

c_last         varchar(16),

c_first        varchar(16),

c_credit_lim   decimal(12,2),

c_balance      decimal(12,2),

c_ytd_payment  decimal(12,2),

c_payment_cnt  integer,

c_delivery_cnt integer,

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)

);

create table bmsql_history (

hist_id  integer,

h_c_id   integer,

h_c_d_id integer,

h_c_w_id integer,

h_d_id   integer,

h_w_id   integer,

h_date   timestamp,

h_amount decimal(6,2),

h_data   varchar(24)

);

create table bmsql_new_order (

no_w_id  integer   not null,

no_d_id  integer   not null,

no_o_id  integer   not null

);

create table bmsql_oorder (

o_w_id       integer      not null,

o_d_id       integer      not null,

o_id         integer      not null,

o_c_id       integer,

o_carrier_id integer,

o_ol_cnt     integer,

o_all_local  integer,

o_entry_d    timestamp

);

create table bmsql_order_line (

ol_w_id         integer   not null,

ol_d_id         integer   not null,

ol_o_id         integer   not null,

ol_number       integer   not null,

ol_i_id         integer   not null,

ol_delivery_d   timestamp,

ol_amount       decimal(6,2),

ol_supply_w_id  integer,

ol_quantity     integer,

ol_dist_info    char(24)

);

create table bmsql_item (

i_id     integer      not null,

i_name   varchar(24),

i_price  decimal(5,2),

i_data   varchar(50),

i_im_id  integer

);

create table bmsql_stock (

s_w_id       integer       not null,

s_i_id       integer       not null,

s_quantity   integer,

s_ytd        integer,

s_order_cnt  integer,

s_remote_cnt integer,

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)

);

Starting BenchmarkSQL LoadData

driver=dm.jdbc.driver.DmDriver

conn=jdbc:dm://127.0.0.1:5236

user=SYSDBA

password=***********

warehouses=100

loadWorkers=20

fileLocation (not defined)

csvNullValue (not defined - using default 'NULL')

Worker 000: Loading ITEM

Worker 001: Loading Warehouse      1

Worker 002: Loading Warehouse      2

Worker 003: Loading Warehouse      3

Worker 004: Loading Warehouse      4

Worker 005: Loading Warehouse      5

Worker 006: Loading Warehouse      6

Worker 007: Loading Warehouse      7

Worker 008: Loading Warehouse      8

Worker 009: Loading Warehouse      9

Worker 010: Loading Warehouse     10

Worker 011: Loading Warehouse     11

Worker 012: Loading Warehouse     12

Worker 013: Loading Warehouse     13

Worker 014: Loading Warehouse     14

Worker 015: Loading Warehouse     15

Worker 016: Loading Warehouse     16

Worker 017: Loading Warehouse     17

Worker 018: Loading Warehouse     18

Worker 019: Loading Warehouse     19

Worker 000: Loading ITEM done

Worker 000: Loading Warehouse     20

Worker 001: Loading Warehouse      1 done

Worker 001: Loading Warehouse     21

Worker 007: Loading Warehouse      7 done

Worker 007: Loading Warehouse     22

Worker 003: Loading Warehouse      3 done

Worker 003: Loading Warehouse     23

Worker 009: Loading Warehouse      9 done

Worker 009: Loading Warehouse     24

Worker 016: Loading Warehouse     16 done

Worker 016: Loading Warehouse     25

Worker 000: Loading Warehouse     20 done

Worker 000: Loading Warehouse     26

Worker 017: Loading Warehouse     17 done

Worker 017: Loading Warehouse     27

Worker 014: Loading Warehouse     14 done

Worker 014: Loading Warehouse     28

Worker 010: Loading Warehouse     10 done

Worker 010: Loading Warehouse     29

Worker 015: Loading Warehouse     15 done

Worker 015: Loading Warehouse     30

Worker 018: Loading Warehouse     18 done

Worker 018: Loading Warehouse     31

Worker 013: Loading Warehouse     13 done

Worker 013: Loading Warehouse     32

Worker 012: Loading Warehouse     12 done

Worker 012: Loading Warehouse     33

Worker 006: Loading Warehouse      6 done

Worker 006: Loading Warehouse     34

Worker 019: Loading Warehouse     19 done

Worker 019: Loading Warehouse     35

Worker 008: Loading Warehouse      8 done

Worker 008: Loading Warehouse     36

Worker 005: Loading Warehouse      5 done

Worker 005: Loading Warehouse     37

Worker 002: Loading Warehouse      2 done

Worker 002: Loading Warehouse     38

Worker 004: Loading Warehouse      4 done

Worker 004: Loading Warehouse     39

Worker 011: Loading Warehouse     11 done

Worker 011: Loading Warehouse     40

Worker 001: Loading Warehouse     21 done

Worker 001: Loading Warehouse     41

Worker 007: Loading Warehouse     22 done

Worker 007: Loading Warehouse     42

Worker 003: Loading Warehouse     23 done

Worker 003: Loading Warehouse     43

Worker 009: Loading Warehouse     24 done

Worker 009: Loading Warehouse     44

Worker 016: Loading Warehouse     25 done

Worker 016: Loading Warehouse     45

Worker 000: Loading Warehouse     26 done

Worker 000: Loading Warehouse     46

Worker 017: Loading Warehouse     27 done

Worker 017: Loading Warehouse     47

Worker 014: Loading Warehouse     28 done

Worker 014: Loading Warehouse     48

Worker 010: Loading Warehouse     29 done

Worker 010: Loading Warehouse     49

Worker 018: Loading Warehouse     31 done

Worker 018: Loading Warehouse     50

Worker 015: Loading Warehouse     30 done

Worker 015: Loading Warehouse     51

Worker 012: Loading Warehouse     33 done

Worker 012: Loading Warehouse     52

Worker 006: Loading Warehouse     34 done

Worker 006: Loading Warehouse     53

Worker 013: Loading Warehouse     32 done

Worker 013: Loading Warehouse     54

Worker 019: Loading Warehouse     35 done

Worker 019: Loading Warehouse     55

Worker 005: Loading Warehouse     37 done

Worker 005: Loading Warehouse     56

Worker 008: Loading Warehouse     36 done

Worker 008: Loading Warehouse     57

Worker 002: Loading Warehouse     38 done

Worker 002: Loading Warehouse     58

Worker 011: Loading Warehouse     40 done

Worker 011: Loading Warehouse     59

Worker 001: Loading Warehouse     41 done

Worker 001: Loading Warehouse     60

Worker 004: Loading Warehouse     39 done

Worker 004: Loading Warehouse     61

Worker 007: Loading Warehouse     42 done

Worker 007: Loading Warehouse     62

Worker 003: Loading Warehouse     43 done

Worker 003: Loading Warehouse     63

Worker 009: Loading Warehouse     44 done

Worker 009: Loading Warehouse     64

Worker 016: Loading Warehouse     45 done

Worker 016: Loading Warehouse     65

Worker 017: Loading Warehouse     47 done

Worker 017: Loading Warehouse     66

Worker 000: Loading Warehouse     46 done

Worker 000: Loading Warehouse     67

Worker 014: Loading Warehouse     48 done

Worker 014: Loading Warehouse     68

Worker 010: Loading Warehouse     49 done

Worker 010: Loading Warehouse     69

Worker 018: Loading Warehouse     50 done

Worker 018: Loading Warehouse     70

Worker 015: Loading Warehouse     51 done

Worker 015: Loading Warehouse     71

Worker 012: Loading Warehouse     52 done

Worker 012: Loading Warehouse     72

Worker 006: Loading Warehouse     53 done

Worker 006: Loading Warehouse     73

Worker 013: Loading Warehouse     54 done

Worker 013: Loading Warehouse     74

Worker 019: Loading Warehouse     55 done

Worker 019: Loading Warehouse     75

Worker 005: Loading Warehouse     56 done

Worker 005: Loading Warehouse     76

Worker 002: Loading Warehouse     58 done

Worker 002: Loading Warehouse     77

Worker 001: Loading Warehouse     60 done

Worker 001: Loading Warehouse     78

Worker 004: Loading Warehouse     61 done

Worker 004: Loading Warehouse     79

Worker 008: Loading Warehouse     57 done

Worker 008: Loading Warehouse     80

Worker 007: Loading Warehouse     62 done

Worker 007: Loading Warehouse     81

Worker 003: Loading Warehouse     63 done

Worker 003: Loading Warehouse     82

Worker 009: Loading Warehouse     64 done

Worker 009: Loading Warehouse     83

Worker 011: Loading Warehouse     59 done

Worker 011: Loading Warehouse     84

Worker 016: Loading Warehouse     65 done

Worker 016: Loading Warehouse     85

Worker 017: Loading Warehouse     66 done

Worker 017: Loading Warehouse     86

Worker 000: Loading Warehouse     67 done

Worker 000: Loading Warehouse     87

Worker 014: Loading Warehouse     68 done

Worker 014: Loading Warehouse     88

Worker 010: Loading Warehouse     69 done

Worker 010: Loading Warehouse     89

Worker 018: Loading Warehouse     70 done

Worker 018: Loading Warehouse     90

Worker 015: Loading Warehouse     71 done

Worker 015: Loading Warehouse     91

Worker 006: Loading Warehouse     73 done

Worker 006: Loading Warehouse     92

Worker 012: Loading Warehouse     72 done

Worker 012: Loading Warehouse     93

Worker 013: Loading Warehouse     74 done

Worker 013: Loading Warehouse     94

 Worker 019: Loading Warehouse     75 done

Worker 019: Loading Warehouse     95

Worker 005: Loading Warehouse     76 done

Worker 005: Loading Warehouse     96

Worker 002: Loading Warehouse     77 done

Worker 002: Loading Warehouse     97

Worker 001: Loading Warehouse     78 done

Worker 001: Loading Warehouse     98

Worker 007: Loading Warehouse     81 done

Worker 007: Loading Warehouse     99

Worker 004: Loading Warehouse     79 done

Worker 004: Loading Warehouse    100

Worker 003: Loading Warehouse     82 done

Worker 009: Loading Warehouse     83 done

Worker 016: Loading Warehouse     85 done

Worker 011: Loading Warehouse     84 done

Worker 008: Loading Warehouse     80 done

Worker 017: Loading Warehouse     86 done

Worker 000: Loading Warehouse     87 done

Worker 014: Loading Warehouse     88 done

Worker 010: Loading Warehouse     89 done

Worker 018: Loading Warehouse     90 done

Worker 015: Loading Warehouse     91 done

Worker 006: Loading Warehouse     92 done

Worker 012: Loading Warehouse     93 done

Worker 013: Loading Warehouse     94 done

Worker 019: Loading Warehouse     95 done

Worker 005: Loading Warehouse     96 done

Worker 001: Loading Warehouse     98 done

Worker 002: Loading Warehouse     97 done

Worker 007: Loading Warehouse     99 done

Worker 004: Loading Warehouse    100 done

# ------------------------------------------------------------

# Loading SQL file ./sql.common/indexCreates.sql

# ------------------------------------------------------------

alter table bmsql_warehouse add constraint bmsql_warehouse_pkey

primary key (w_id);

alter table bmsql_district add constraint bmsql_district_pkey

primary key (d_w_id, d_id);

alter table bmsql_customer add constraint bmsql_customer_pkey

primary key (c_w_id, c_d_id, c_id);

create index bmsql_customer_idx1

on  bmsql_customer (c_w_id, c_d_id, c_last, c_first);

alter table bmsql_oorder add constraint bmsql_oorder_pkey

primary key (o_w_id, o_d_id, o_id);

create unique index bmsql_oorder_idx1

on  bmsql_oorder (o_w_id, o_d_id, o_carrier_id, o_id);

alter table bmsql_new_order add constraint bmsql_new_order_pkey

primary key (no_w_id, no_d_id, no_o_id);

alter table bmsql_order_line add constraint bmsql_order_line_pkey

primary key (ol_w_id, ol_d_id, ol_o_id, ol_number);

alter table bmsql_stock add constraint bmsql_stock_pkey

primary key (s_w_id, s_i_id);

alter table bmsql_item add constraint bmsql_item_pkey

primary key (i_id);

# ------------------------------------------------------------

# Loading SQL file ./sql.common/foreignKeys.sql

# ------------------------------------------------------------

alter table bmsql_district add constraint d_warehouse_fkey

foreign key (d_w_id)

references bmsql_warehouse (w_id);

alter table bmsql_customer add constraint c_district_fkey

foreign key (c_w_id, c_d_id)

references bmsql_district (d_w_id, d_id);

alter table bmsql_history add constraint h_customer_fkey

foreign key (h_c_w_id, h_c_d_id, h_c_id)

references bmsql_customer (c_w_id, c_d_id, c_id);

alter table bmsql_history add constraint h_district_fkey

foreign key (h_w_id, h_d_id)

references bmsql_district (d_w_id, d_id);

alter table bmsql_new_order add constraint no_order_fkey

foreign key (no_w_id, no_d_id, no_o_id)

references bmsql_oorder (o_w_id, o_d_id, o_id);

alter table bmsql_oorder add constraint o_customer_fkey

foreign key (o_w_id, o_d_id, o_c_id)

references bmsql_customer (c_w_id, c_d_id, c_id);

  alter table bmsql_order_line add constraint ol_order_fkey

foreign key (ol_w_id, ol_d_id, ol_o_id)

references bmsql_oorder (o_w_id, o_d_id, o_id);

  alter table bmsql_order_line add constraint ol_stock_fkey

foreign key (ol_supply_w_id, ol_i_id)

references bmsql_stock (s_w_id, s_i_id);

 alter table bmsql_stock add constraint s_warehouse_fkey

foreign key (s_w_id)

references bmsql_warehouse (w_id);

alter table bmsql_stock add constraint s_item_fkey

foreign key (s_i_id)

references bmsql_item (i_id);

ERROR: Cannot locate SQL file for extraHistID

# ------------------------------------------------------------

# Loading SQL file ./sql.common/buildFinish.sql

# ------------------------------------------------------------

-- ----

-- Extra commands to run after the tables are created, loaded,

-- indexes built and extra's created.

四、开始压测

root@:/home/dmdba/benchmarksql-5.0/run# ./runBenchmark.sh  props.dm

12:04:00,984 [main] INFO   jTPCC : Term-00,

12:04:00,986 [main] INFO   jTPCC : Term-00, +-------------------------------------------------------------+

12:04:00,986 [main] INFO   jTPCC : Term-00,      BenchmarkSQL v5.0

12:04:00,986 [main] INFO   jTPCC : Term-00, +-------------------------------------------------------------+

12:04:00,986 [main] INFO   jTPCC : Term-00,  (c) 2003, Raul Barbosa

12:04:00,986 [main] INFO   jTPCC : Term-00,  (c) 2004-2016, Denis Lussier

12:04:00,988 [main] INFO   jTPCC : Term-00,  (c) 2016, Jan Wieck

12:04:00,988 [main] INFO   jTPCC : Term-00, +-------------------------------------------------------------+

12:04:00,988 [main] INFO   jTPCC : Term-00,

12:04:00,998 [main] INFO   jTPCC : Term-00, db=dm

12:04:00,998 [main] INFO   jTPCC : Term-00, driver=dm.jdbc.driver.DmDriver

12:04:00,998 [main] INFO   jTPCC : Term-00, conn=jdbc:dm://127.0.0.1:5236

12:04:00,998 [main] INFO   jTPCC : Term-00, user=SYSDBA

12:04:00,998 [main] INFO   jTPCC : Term-00,

12:04:00,998 [main] INFO   jTPCC : Term-00, warehouses=100

12:04:00,999 [main] INFO   jTPCC : Term-00, terminals=150

12:04:01,003 [main] INFO   jTPCC : Term-00, runMins=10

12:04:01,003 [main] INFO   jTPCC : Term-00, limitTxnsPerMin=0

12:04:01,003 [main] INFO   jTPCC : Term-00, terminalWarehouseFixed=true

12:04:01,003 [main] INFO   jTPCC : Term-00,

12:04:01,003 [main] INFO   jTPCC : Term-00, newOrderWeight=45

12:04:01,003 [main] INFO   jTPCC : Term-00, paymentWeight=43

12:04:01,003 [main] INFO   jTPCC : Term-00, orderStatusWeight=4

12:04:01,003 [main] INFO   jTPCC : Term-00, deliveryWeight=4

12:04:01,004 [main] INFO   jTPCC : Term-00, stockLevelWeight=4

12:04:01,004 [main] INFO   jTPCC : Term-00,

12:04:01,004 [main] INFO   jTPCC : Term-00, resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS

12:04:01,004 [main] INFO   jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py

12:04:01,004 [main] INFO   jTPCC : Term-00,

12:04:01,021 [main] INFO   jTPCC : Term-00, copied props.dm to my_result_2023-12-05_120401/run.properties

12:04:01,027 [main] INFO   jTPCC : Term-00, created my_result_2023-12-05_120401/data/runInfo.csv for runID 10

12:04:01,028 [main] INFO   jTPCC : Term-00, writing per transaction results to my_result_2023-12-05_120401/data/result.csv

12:04:01,029 [main] INFO   jTPCC : Term-00, osCollectorScript=./misc/os_collector_linux.py

12:04:01,029 [main] INFO   jTPCC : Term-00, osCollectorInterval=1

12:04:01,029 [main] INFO   jTPCC : Term-00, osCollectorSSHAddr=null

12:04:01,029 [main] INFO   jTPCC : Term-00, osCollectorDevices=net_eth0 blk_sda

12:04:01,047 [main] INFO   jTPCC : Term-00,

Traceback (most recent call last):

  File "<stdin>", line 299, in <module>

  File "<stdin>", line 90, in main

  File "<stdin>", line 269, in initNetDevice

IOError: [Errno 2] No such file or directory: '/sys/class/net/eth0/statistics/rx_packets'

12:04:01,049 [Thread-0] ERROR  OSCollector$CollectData : OSCollector, unexpected EOF while reading from external helper process

12:04:01,201 [main] INFO   jTPCC : Term-00, C value for C_LAST during load: 149

12:04:01,202 [main] INFO   jTPCC : Term-00, C value for C_LAST this run:    252

12:04:01,202 [main] INFO   jTPCC : Term-00,

12:05:15,369 [Thread-102] ERROR  jTPCCTData : Unexpected SQLException in NEW_ORDER Usage: 1445MB / 2552MB          

12:05:15,393 [Thread-102] ERROR  jTPCCTData : 死锁

dm.jdbc.driver.DMException: 死锁

        at dm.jdbc.driver.DBError.throwException(DBError.java:670)

        at dm.jdbc.a.b.p.F(MSG.java:536)

        at dm.jdbc.a.b.p.C(MSG.java:496)

        at dm.jdbc.a.b.p.B(MSG.java:477)

        at dm.jdbc.a.a.a(DBAccess.java:837)

        at dm.jdbc.a.a.a(DBAccess.java:345)

        at dm.jdbc.a.a.a(DBAccess.java:462)

        at dm.jdbc.driver.DmdbPreparedStatement.executeInner(DmdbPreparedStatement.java:324)

        at dm.jdbc.driver.DmdbPreparedStatement.do_executeQuery(DmdbPreparedStatement.java:422)

        at dm.jdbc.driver.DmdbPreparedStatement.executeQuery(DmdbPreparedStatement.java:1490)

        at jTPCCTData.executeNewOrder(jTPCCTData.java:480)

        at jTPCCTData.execute(jTPCCTData.java:95)

        at jTPCCTerminal.executeTransactions(jTPCCTerminal.java:261)

        at jTPCCTerminal.run(jTPCCTerminal.java:88)

        at java.base/java.lang.Thread.run(Thread.java:834)

 erm-00, Running Average tpmTOTAL: 93679.05    Current tpmTOTAL: 6184092    Memory Usage: 344MB / 2552MB            

12:14:02,750 [Thread-134] INFO   jTPCC : Term-00,

12:14:02,751 [Thread-134] INFO   jTPCC : Term-00,

12:14:02,752 [Thread-134] INFO   jTPCC : Term-00, Measured tpmC (NewOrders) = 42120.99

12:14:02,752 [Thread-134] INFO   jTPCC : Term-00, Measured tpmTOTAL = 93546.93

12:14:02,753 [Thread-134] INFO   jTPCC : Term-00, Session Start     = 2023-12-05 12:04:01

12:14:02,753 [Thread-134] INFO   jTPCC : Term-00, Session End       = 2023-12-05 12:14:02

12:14:02,753 [Thread-134] INFO   jTPCC : Term-00, Transaction Count = 937001

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

闽ICP备14008679号