This tool is based on the benchmark tool TPC-H. This repo contains automation of running the TPC-H benchmark on an existing Hashdata cluster.
TPC has published the following TPC-H standards over time:
| TPC-H Benchmark Version | Published Date | Standard Specification |
|---|---|---|
| 3.0.0 (latest) | 2021/02/18 | https://tpc.org/TPC_Documents_Current_Versions/pdf/tpc-h_v3.0.0.pdf |
- A running HashData Database with
gpadminaccess gpadmindatabase is createdrootaccess on the master nodemdwfor installing dependenciessshconnections betweenmdwand the segment nodessdw1..n
All the following examples are using standard host name convention of HashData using mdw for master node, and sdw1..n for the segment nodes.
Make sure that gcc and make are intalled on mdw for compiling the dbgen (data generation) and qgen (query generation).
You can install the dependencies on mdw:
ssh root@mdw
yum -y install gcc makeThe original source code is from http://tpc.org/tpc_documents_current_versions/current_specifications5.asp.
You can get released version from the .tar file:
curl -LO https://github.com/hashdata-xyz/TPC-H-HashData/archive/refs/tags/v1.4.tar.gz
tar xzf v1.4.tar.gz
mv TPC-H-HashData-1.4 TPC-H-HashData
OR get the current version by downloading with git:
ssh gpadmin@mdw
git clone https://github.com/hashdata-xyz/TPC-H-HashData.gitPut the folder under /home/gpadmin/ and change owner to gpadmin.
chown -R gpadmin.gpadmin TPC-H-HashData
To run the benchmark, login as gpadmin on mdw:
ssh gpadmin@mdw
cd ~/TPC-H-HashData
./tpch.sh
Or running the benchmark as a background process:
sh run.shBy default, it will run a scale 1 (1G) and with 2 concurrent users, from data generation to score computation.
By changing the tpch_variables.sh, we can control how this benchmark will run.
This is the default example at tpch_variables.sh
# environment options
ADMIN_USER="gpadmin"
BENCH_ROLE="hbench"
SCHEMA_NAME="tpch"
GREENPLUM_PATH=$GPHOME/greenplum_path.sh
CHIP_TYPE="arm"
# benchmark options
GEN_DATA_SCALE="1"
MULTI_USER_COUNT="2"
# step options
RUN_COMPILE_tpch="true"
RUN_GEN_DATA="true"
RUN_INIT="true"
RUN_DDL="true"
RUN_LOAD="true"
RUN_SQL="true"
RUN_SINGLE_USER_REPORTS="true"
RUN_MULTI_USER="true"
RUN_MULTI_USER_REPORTS="true"
RUN_SCORE="true"
# misc options
SINGLE_USER_ITERATIONS="1"
EXPLAIN_ANALYZE="false"
RANDOM_DISTRIBUTION="false"
ORCA_OPTIMIZER="true"
STATEMENT_MEM="2GB"
STATEMENT_MEM_MULTI_USER='1GB'tpch.sh will validate existence of those variables.
# environment options
ADMIN_USER="gpadmin"
ADMIN_USER="gpadmin"
BENCH_ROLE="hbench"
SCHEMA_NAME="tpch"
GREENPLUM_PATH=$GPHOME/greenplum_path.sh
CHIP_TYPE="arm"These are the setup related variables:
-
ADMIN_USER: defaultgpadmin. It is the default database administrator account, as well as the user accessible to allmdwandsdw1..nmachines. -
CHIP_TYPE: defaultarm, can be set tox86. Set this according to the CPU type of the machince running this test. If included binaries works, compiling will be skipped, otherwise, will try to compile from source code.Included binaries: x86 on Centos7 and ARM on Centos7.
Note: The benchmark related files for each segment node are located in the segment's
${PGDATA}/hbenchmarkdirectory. If there isn't enough space in this directory in each segment, you can create a symbolic link to a drive location that does have enough space.
In most cases, we just leave them to the default.
# benchmark options
GEN_DATA_SCALE="1"
MULTI_USER_COUNT="2"These are the benchmark controlling variables:
GEN_DATA_SCALE: default1. Scale 1 is 1G.MULTI_USER_COUNT: default2. It's also usually referred asCU, i.e. concurrent user. It controls how many concurrent streams to run during the throughput run.
If evaluating Greenplum cluster across different platforms, we recommend to change this section to 3TB with 5CU:
# benchmark options
MULTI_USER_COUNT="5"
GEN_DATA_SCALE="3000"# step options
RUN_COMPILE_tpch="true"
RUN_GEN_DATA="true"
RUN_INIT="true"
RUN_DDL="true"
RUN_LOAD="true"
RUN_SQL="true"
RUN_SINGLE_USER_REPORT="true"
RUN_MULTI_USER="true"
RUN_MULTI_USER_REPORTS="true"
RUN_SCORE="true"There are multiple steps running the benchmark and controlled by these variables:
RUN_COMPILE_tpch: defaulttrue. It will compile thedbgenandqgen. Usually we only want to compile those binaries once. In the rerun, just set this value tofalse.RUN_GEN_DATA: defaulttrue. It will use thedbgencompiled above to generate the flat files for the benchmark. The flat files are generated in parallel on all segment nodes. Those files are stored under${PGDATA}/hbenchmarkdirectory. In the rerun, just set this value tofalse.RUN_INIT: defaulttrue. It will setup the GUCs for the Greenplum as well as remember the segment configurations. It's only required if the Greenplum cluster is reconfigured. It can be alwaystrueto ensure proper Greenplum cluster configuration. In the rerun, just set this value tofalse.RUN_DDL: defaulttrue. It will recreate all the schemas and tables (including external tables for loading). If you want to keep the data and just rerun the queries, please set this value tofalse, otherwise all the existing loaded data will be gone.RUN_LOAD: defaulttrue. It will load data from flat files into tables. After the load, the statistics will be computed in this step. If you just want to rerun the queries, please set this value tofalse.RUN_SQL: defaulttrue. It will run the power test of the benchmark.RUN_SINGLE_USER_REPORTS: defaulttrue. It will upload the results to the Greenplum databasegpadminunder schematpch_reports. These tables are required later on in theRUN_SCOREstep. Recommend to keep ittrueif above step ofRUN_SQListrue.RUN_MULTI_USER: defaulttrue. It will run the throughput run of the benchmark. Before running the queries, multiple streams will be generated by theqgen.qgenwill sample the database to find proper filters. For very large database and a lot of streams, this process can take a long time (hours) to just generate the queries.RUN_MULTI_USER_REPORTS: defaulttrue. It will upload the results to the Greenplum databasegpadminunder schematpch_reports. Recommend to keep ittrueif above step ofRUN_MULTI_USERistrue.RUN_SCORE: defaulttrue. Run this step will print summary for this execution. todo: It will query the results fromtpch_reportsand compute theQphDSbased on supported benchmark standard. This function is not supported in the current version as this tool currently only support query tests not refresh functions yet.
If any above variable is missing or invalid, the script will abort and show the missing or invalid variable name.
WARNING: Now TPC-H does not rely on the log folder to run or skip the steps. It will only run the steps that are specified explicitly as true in the tpch_variables.sh. If any necessary step is speficied as false but has never been executed before, the script will abort when it tries to access something that does not exist in the database or under the directory.
# misc options
EXPLAIN_ANALYZE="false"
RANDOM_DISTRIBUTION="false"
SINGLE_USER_ITERATIONS="1"
STATEMENT_MEM="2GB"
STATEMENT_MEM_MULTI_USER='1GB'These are miscellaneous controlling variables:
EXPLAIN_ANALYZE: defaultfalse. If you set totrue, you can have the queries execute withEXPLAIN ANALYZEin order to see exactly the query plan used, the cost, the memory used, etc. This option is for debugging purpose only, since collecting those query statistics will disturb the benchmark.RANDOM_DISTRIBUTION: defaultfalse. If you set totrue, the fact tables are distributed randomly other than following a pre-defined distribution column.SINGLE_USER_ITERATION: default1. This controls how many times the power test will run. During the final score computation, the minimal/fastest query elapsed time of multiple runs will be used. This can be used to ensure the power test is in awarmrun environment.STATEMENT_MEM: default 2GB which set thestatement_memparameter for each statement of single user test. Set withGBorMB. STATEMENT_MEM should be less than gp_vmem_protect_limit.STATEMENT_MEM_MULTI_USER: default 1GB which set thestatement_memparameter for each statement of multiple user test. Set withGBorMB. Please note that,STATEMENT_MEM_MULTI_USER*MULTI_USER_COUNTshould be less thangp_vmem_protect_limit.
Table storage is defined in functions.sh and is configured for optimal performance.
get_version() function defines different storage options for different scale of the benchmark.
SMALL_STORAGE:nationandregionMEDIUM_STORAGE:customer,part,partsupp, andsupplierLARGE_STORAGE:lineitemandorders
Table distribution keys are defined in ../03_ddl/distribution.txt, you can modify tables' distribution keys by changing this file. You can set the distribution method to hash with colunm names or "REPLICATED".
- Change different storage options in
functions.shto try with different compress options and whether use AO/CO storage. - Replace some of the tables' DDL with the
*.sql.partitionfiles in folder03_ddlto use partition for some of the non-dimension tables. No partition is used by default. - Steps
RUN_COMPILE_tpchandRUN_GEN_DATAonly need to be executed once. - ORCA optimizer can be adjusted by changing the file
../TPC-H-Hashdata/01_gen_data/optimizer.txt. You can turn ORCAonorofffor all 22 queries by changing appropriate row of this file.
- Query alternative 15 was used in favor of the original so it is easier to parse in these scripts. Performance is essentially the same for both versions.
- Query 1 documentation doesn't match query provided by TPC. Range is supposed to be dynamically set between 60 and 120 days and substitution doesn't seem to be working with qgen. So, hard code 90 days until this can be fixed by TPC.