crazycs520 / loadgen

generate database load

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

loadgen

build

make

example:

# bench const SQL qps
bin/loadgen bench --sql "select * from t" --host 127.0.0.1 --port 4000 --db test --thread 5

# bench rand SQL qps, use `#rand-val` to generate rand value, the rand value is between `valmin` and `valmax`
bin/loadgen bench --sql "select * from t where id=#rand-val" --host 127.0.0.1 --port 4000 --db test --thread 5 --valmin=0 --valmax=100

# use bench command to create 10000 tables. the `#seq-val` is a sequence value, from `valmin` to `valmax`
bin/loadgen bench --sql " create table if not exists t#seq-val (a int key, b int)" --valmin 0 --valmax 10000 --thread 1

# generate payload: full table scan with aggregation
# the SQL is select sum(a+b+e), sum(a*b), sum(a*e), sum(b*e), sum(a*b*e) from test.t_full_table_scan; 
# the total table rows is 1000
bin/loadgen payload full-table-scan --rows=1000

# generate payload: full table scan without aggregation
# the SQL is select * from test.t_full_table_scan;
# the total table rows is 100
bin/loadgen payload full-table-scan --rows=100 --agg=false


# generate payload: full index lookup with aggregation
# the SQL is select sum(a+e), max(c) from test.t_full_index_lookup use index (idx0);
# the total table rows is 100
bin/loadgen payload full-index-lookup --rows 100

# generate payload: full index scan with aggregation
# the SQL is select sum(b), avg(b), min(b), max(b) from test.t_full_index_scan use index (idx0);
# the total table rows is 10000
bin/loadgen payload full-index-scan --rows 10000

payload generator usage

loadgen already contain many payload generator, you can run following command to see the all supported payload:

▶ bin/loadgen payload -h
run the specified payload

Usage:
  loadgen payload [flags]
  loadgen payload [command]

Available Commands:
  big-insert              payload of big-insert in 1 statements
  fix-point-get           payload of fix-point-get
  fix-update-key          payload of fix-update-key
  full-index-lookup       payload of full-index-lookup
  full-index-scan         payload of full-index-scan
  full-table-scan         payload of full-table-scan
  gen-stmt                payload of generate many kind of statements
  index-lookup-for-update payload of index-lookup-for-update
  normal-oltp             payload of normal OLTP test, such as select, point-get, insert, update
  point-get-for-update    payload of point-get-for-update
  rand-batch-point-get    payload of rand-batch-point-get
  rand-point-get          payload of rand-point-get
  write-auto-inc          payload for write auto increment
  write-conflict          payload of write conflict
  write-hot               payload of write hot, such as insert with auto_increment, timestamp index
  write-random            payload of write random in batchs
  write-timestamp-index   payload for test insert into table whose content is a column of timestamp and the column's index.

About

generate database load


Languages

Language:Go 94.6%Language:Shell 5.1%Language:Makefile 0.3%