在HGDB v4.3.2版本上进行BenchmarkSQL测试

本文介绍如何使用BenchmarkSQL工具进行数据库性能测试,包括环境搭建、配置文件修改、数据库构建及测试运行等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载

https://sourceforge.net/projects/benchmarksql/?source=typ_redirect

0. Requirements


    Use of JDK7 is required.---经过我测试,使用rhel自带的openjdk就行。


1. Create the benchmarksql user and a database


    As Unix user postgres use the psql shell to connect to the postgres
    database and issue the CREATE USER and CREATE DATABASE commands.

 

    [postgres#localhost ~] $ psql postgres
    psql (9.5.2)
    Type "help" for help.


    postgres=# CREATE USER benchmarksql WITH ENCRYPTED PASSWORD 'changeme';
    postgres=# CREATE DATABASE benchmarksql OWNER benchmarksql;
    postgres=# \q
    [postgres#localhost ~] $

 

 


2. Compile the BenchmarkSQL source code

 

 

 

 

 

   [wieck@localhost ~] $ cd benchmarksql
   yum install ant
   vi  +23  build.xml 定位到第23行
       <javac encoding="utf-8" srcdir="${src}" destdir="${build}" classpathref="classpath"
              ~~~~~~~~~~~~~~~这是新加的
 		
   [wieck@localhost ~] $ cd benchmarksql
   [wieck@localhost benchmarksql] $ ant

 





3. Create the benchmark configuration file


    [wieck@localhost benchmarksql] $ cd run
    [wieck@localhost run] $ cp props.pg my_postgres.properties
    [wieck@localhost run] $ vi my_postgres.properties
    [wieck@localhost run] $ 

   [pg132@dbserver1 run]$ pwd
   /home/pg132/benchmarksql-5.0/run
   [pg132@dbserver1 run]$ vi +36 my_postgres.properties 

     osCollectorDevices=net_ens33 blk_sda
                                            ~~~~~     ~~~~此处自己写网卡名称和磁盘名称

如下是修改过的参数

 

 

[highgo@hgdb01 run]$ cat my_postgres.properties 
db=postgres
driver=org.postgresql.Driver
conn=jdbc:postgresql://192.168.80.172:5432/benchmarksql?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
user=benchmarksql
password=changeme


warehouses=1
loadWorkers=4


terminals=5
//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
//The default percentages of 45, 43, 4, 4 & 4 match the TPC-C spec
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_enp0s3 blk_sda
[highgo@hgdb01 run]$ 


4. Build the schema and initial database load


    Execute the runDatabaseBuild.sh script with your configuration file.


    [wieck@localhost run]$ ./runDatabaseBuild.sh my_postgres.properties

5. Run the configured benchmark


    [wieck@localhost run]$ ./runBenchmark.sh my_postgres.properties


6. Scale the benchmark configuration.


    Change the my_postgres.properties file to the correct scaling
    (number of warehouses and concurrent connections/terminals). Switch
    from using a transaction count to time based:


        runTxnsPerTerminal=0
runMins=180


    Rebuild the database (if needed) by running


    [wieck@localhost run]$ ./runDatabaseDestroy.sh my_postgres.properties
    [wieck@localhost run]$ ./runDatabaseBuild.sh my_postgres.properties


    Then run the benchmark again.


    Rinse and repeat.


7. Result report


    BenchmarkSQL collects detailed performance statistics and (if
    configured) OS performance data. The example configuration file
    defaults to a directory starting with my_result_.


    Use the generateReport.sh DIRECTORY script to create an HTML file
    with graphs. This requires R to be installed, which is beyond the
    scope of this HOW-TO.

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值