下载
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.