To facilitate this, TiUP has integrated the bench component, which currently provides two workloads for pressure testing: tpcc and tpch, with the following command parameters:
[user@localhost ~]# tiup bench
Starting component `bench`: /Users/joshua/.tiup/components/bench/v0.0.1/bench
Benchmark database with different workloads
Usage:
tiup bench [command]
Available Commands:
help Help about any command
tpcc TPC-C workload
tpch TPC-H workload
Flags:
--count int Total execution count, 0 means infinite
-D, --db string Database name (default "test")
-d, --driver string Database driver: mysql
--dropdata Cleanup data before prepare
-h, --help help for /Users/joshua/.tiup/components/bench/v0.0.1/bench
-H, --host string Database host (default "127.0.0.1")
--ignore-error Ignore error when running workload
--interval duration Output interval time (default 10s)
--isolation int Isolation Level 0: Default, 1: ReadUncommitted,
2: ReadCommitted, 3: WriteCommitted, 4: RepeatableRead,
5: Snapshot, 6: Serializable, 7: Linerizable
--max-procs int runtime.GOMAXPROCS
-p, --password string Database password
-P, --port int Database port (default 4000)
--pprof string Address of pprof endpoint
--silence Don't print error when running workload
--summary Print summary TPM only, or also print current TPM when running workload
-T, --threads int Thread concurrency (default 16)
--time duration Total execution time (default 2562047h47m16.854775807s)
-U, --user string Database user (default "root")
The commands and parameters of TPC-C are as follows:
Available Commands:
check check for data consistency
cleanup clear data
prepare prepare data
run run benchmark
Flags:
--check-all run all consistency checks
-h, --help tpcc help information
--output string directory where csv file is generated when data is prepared
--parts int number of partition repositories (default 1)
--tables string specifies the tables used to generate the file, multiple tables can be split, only valid if output is set. All tables are generated by default
--warehouses int number of repositories (default 10)
- Create 4 repositories using 4 partitions with hash
tiup bench tpcc --warehouses 4 --parts 4 prepare
- Running TPC-C benchmark
tiup bench tpcc --warehouses 4 run
- Cleanup data
tiup bench tpcc --warehouses 4 cleanup
- Checking consistency
tiup bench tpcc --warehouses 4 check
- Generating csv files
tiup bench tpcc --warehouses 4 prepare --output data
- Generate csv files for specified tables
tiup bench tpcc --warehouses 4 prepare --output data --tables history,orders
- Turn on pprof
tiup bench tpcc --warehouses 4 prepare --output data --pprof :10111
The commands and parameters of TPC-C are as follows:
Available Commands:
cleanup cleanup data
prepare prepare data
run run benchmark
Flags:
--check checks the output data, only valid if the scale factor is 1
-h, --help tpch help information
--queries string All query statements (default "q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13,q14,q15,q16,q17,q18,q19,q20,q21,q22")
--sf int scale factor
- Data preparation
# Prepare data with scale factor 1
tiup bench tpch --sf=1 prepare
# Or prepare data with scale factor 1, create tiflash replica, and analyze table after data loaded
tiup bench tpch --sf=1 --analyze --tiflash prepare
- Benchmarking and checking results
tiup bench tpch --sf=1 --check=true run
- Benchmarking without checking results
tiup bench tpch --sf=1 run
- Cleanup
tiup bench tpch cleanup